How can I install dos2unix in windows docker application?

Viewed 5361

I want to install dos2unix into my Windows docker application to convert line endings.

How can I do that?

Here's my docker nginx file:

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 Answers

The nginx image is based on Debian (see: https://hub.docker.com/_/nginx/). To install dos2unix you can use the apt-get command. For example:

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"
Related