Osedea / nodock

Docker Compose for Node projects with Node, MySQL, Redis, MongoDB, NGINX, Apache2, Memcached, Certbot and RabbitMQ images
http://nodock.io
MIT License
762 stars 189 forks source link

Error building nginx service #102

Closed Granga closed 6 years ago

Granga commented 6 years ago

I get error when running the docker-compose up -d mongo node nginx command. My OS: Windows 8.1 Terminal: Hyper

Here is the command's output:

$ docker-compose up -d mongo node nginx
Building nginx
Step 1/16 : FROM nginx:1.11
 ---> 5766334bdaa0
Step 2/16 : RUN mkdir /etc/nginx/sites-available && rm /etc/nginx/conf.d/default.conf
 ---> Using cache
 ---> 4892dddb739b
Step 3/16 : ADD nginx.conf /etc/nginx/
 ---> Using cache
 ---> 03b774e4cfd5
Step 4/16 : COPY scripts /root/scripts/
 ---> Using cache
 ---> 36c6047daf6a
Step 5/16 : COPY certs /etc/ssl/
 ---> Using cache
 ---> b90502ed266c
Step 6/16 : COPY sites /etc/nginx/templates
 ---> Using cache
 ---> 19c271ddb0af
Step 7/16 : ARG WEB_REVERSE_PROXY_PORT=8000
 ---> Using cache
 ---> f81484e144ab
Step 8/16 : ARG WEB_SSL=false
 ---> Using cache
 ---> c8811228c3df
Step 9/16 : ARG SELF_SIGNED=false
 ---> Using cache
 ---> dcfdad9868e4
Step 10/16 : ARG NO_DEFAULT=false
 ---> Using cache
 ---> ce8f9a09dc8b
Step 11/16 : ENV WEB_REVERSE_PROXY_PORT=$WEB_REVERSE_PROXY_PORT
 ---> Using cache
 ---> f917d6e76e24
Step 12/16 : ENV WEB_SSL=$WEB_SSL
 ---> Using cache
 ---> 302da37baf92
Step 13/16 : ENV SELF_SIGNED=$SELF_SIGNED
 ---> Using cache
 ---> fa5467ae20c8
Step 14/16 : ENV NO_DEFAULT=$NO_DEFAULT
 ---> Using cache
 ---> a1e25dc9605c
Step 15/16 : RUN /bin/bash /root/scripts/build-nginx.sh
 ---> Running in ddbcba4481b9
/root/scripts/build-nginx.sh: line 2: $'\r': command not found
/root/scripts/build-nginx.sh: line 3: syntax error near unexpected token `$'do\r''
'root/scripts/build-nginx.sh: line 3: `for conf in /etc/nginx/templates/*.conf; do
ERROR: Service 'nginx' failed to build: The command '/bin/sh -c /bin/bash /root/scripts/build-nginx.sh' returned a non-zero code: 2
philtrep commented 6 years ago

@Granga looks like a line ending problem, try running sed -i 's/\r$//' build-nginx.sh then rebuild

Granga commented 6 years ago

Yes, to solve this problem, I run these commands:

cd nginx/scripts
sed -i 's/\r$//' build-nginx.sh
sed -i 's/\r$//' run-openssl.sh

Thank you.