I'm currently trying to execute a bash script inside my Nginx container and then keeping it alive of course.
So, my idea was to do what I need to in the bash script and as the last command, the command found with a docker-compose ps. But the container keeps shutting down. Here is a summary of what I currently have
The Dockerfile
FROM nginx:latest
COPY ./run.sh /root/run.sh
RUN ["chmod", "+x", "/root/run.sh"]
CMD ["/root/run.sh"]
run.sh
#!/bin/bash
nginx -g daemon off;
Am I missing something?
You need to use: nginx -g "daemon off;", with the option quoted.