Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

docker nginx deployment entrypoint

Tags:

docker

nginx

I have a dockerized nginx that works great if I run a shell, but (naturally enough) if I give "nginx start" itself as the entrypoint, it just daemonizes and exits immediately for lack of a process to wait for.

My inclination is just to do something like this:

pid=$(cat /run/nginx.pid)
while ps ax | awk '{print $1}' | grep -q $pid; do
    sleep 60
done

Though this seems like quite a hack. But when I google for examples, I see people running bash.

Any pointers?

like image 685
jma Avatar asked Dec 08 '14 09:12

jma


1 Answers

Well I opened up the Dockerfile from the official nginx container for you and saw they use:

CMD ["nginx", "-g", "daemon off;"]
like image 125
Peter Lyons Avatar answered Oct 06 '22 03:10

Peter Lyons