I am trying to install nginx (and then nodejs) in my container. I have my own nginx config files in nginx/ folder:
# --- Release with Alpine ----
FROM phusion/baseimage:0.10.1
# Create app directory
WORKDIR /app
RUN apt-get update \
&& apt-get -y install nginx
RUN ls /etc/nginx
COPY nginx/nginx.conf /etc/nginx/nginx.conf
RUN ls /etc/nginx
RUN ls /etc/nginx/sites-enabled
RUN rm /etc/nginx/sites-enabled/default
COPY nginx/serverlogic /etc/nginx/sites-enabled/serverlogic
RUN ls /etc/nginx/sites-enabled
RUN nginx -s reload
RUN echo "$PWD FINALFINALFINAL" && ls
EXPOSE 8080
But I get an error on RUN nginx -s reload
line saying: "nginx: [error] open() "/run/nginx.pid" failed (2: No such file or directory)". What is that?
p.s. Is there some image on docker hub with ubuntu, node.js and nginx installed? I want to put them in one container for simplicity.
nginx -s reload
can only be used when nginx is running. It sends a signal to the master process of nginx which itself notifies the worker processes.
The problem here is, that you do not have a nginx instance running during your build process. So you are unable to reload it.
It is not a real problem though. Since nginx is not running, you do not need to reload it. After starting nginx (with an runit init file when using the phusion base image), it will be loading your provided configuration.
That said, I would not recommend running multiple services in a single container though. It is easy enough with docker-compose to orchestrate multiple containers nowadays.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With