I am having an issue where /etc/init.d/nginx restart is apparently failing (though I don’t see evidence of that in the intermediate container or in the logs), but it works fine once I attach the container and do it manually. Here is what everything looks like:
Dockerfile
FROM debian:jessie
MAINTAINER Kenyon Haliwell <kenyon@moveyourmountain.org>
RUN apt-get update && \
apt-get -y install curl git nginx && \
apt-get clean && \
curl -sL https://deb.nodesource.com/setup_5.x | bash - && \
apt-get -y install nodejs && \
npm install -g bower && \
rm -rf /var/www/html
COPY nginx-default.conf /etc/nginx/sites-available/default
RUN mkdir -p /var/www/frontend/code/app
WORKDIR /var/www/frontend
RUN /etc/init.d/nginx restart
All of it works except the last line. Here is my run command:
docker run --name mym_frontend1 -v /var/www/resources/mymv4/frontend:/var/www/frontend -p 8080:80 -dit mym_frontend
So basically, at this point if I go to my browser and go to localhost:8080 I get a ‘Connect Reset’ error. However, if I attach the container (docker attach mym_frontend1) and then do /etc/init.d/nginx restart then go back to my browser, localhost:8080 works fine.
So I am just really confused about how it doesn’t get started properly in the Dockerfile, but works just fine with I do it manually. Is there any solutions to this problem?
Thanks!