Axiol
Axiol

Reputation: 5962

Keep an Nginx alive after a bash script

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?

Upvotes: 4

Views: 1442

Answers (1)

Thiago Almeida
Thiago Almeida

Reputation: 380

You need to use: nginx -g "daemon off;", with the option quoted.

Upvotes: 5

Related Questions