如何在Windows Docker应用程序中安装dos2unix?

时间:2018-09-18 05:55:40

标签: docker unix

我想将dos2unix安装到Windows docker应用程序中以转换行尾。

我该怎么做?

这是我的docker nginx文件:

FROM nginx:1

ADD ./etc/vhost.template /etc/nginx/conf.d/vhost.template
ADD ./run.sh /run.sh

VOLUME [ "/var/www/html" ]
VOLUME [ "/var/log/nginx" ]

RUN sed -i 's/\r$//' /run.sh

CMD /bin/bash -c "sh /run.sh"

1 个答案:

答案 0 :(得分:0)

nginx图像基于Debian(请参阅:https://hub.docker.com/_/nginx/)。要安装dos2unix,可以使用apt-get命令。例如:

FROM nginx:1

ADD ./etc/vhost.template /etc/nginx/conf.d/vhost.template
ADD ./run.sh /run.sh

VOLUME [ "/var/www/html" ]
VOLUME [ "/var/log/nginx" ]

RUN apt-get update && \
    apt-get install dos2unix && \
    apt-get clean

RUN sed -i 's/\r$//' /run.sh

CMD /bin/bash -c "sh /run.sh"