Reputation: 2910
I'm using the jonasal/nginx-certbot:latest to run several services under NGINX with automatic certificate generation.
I now want to create a second instance for UAT testing where all domains shift from [subdomain].domain.com
to [subdomain]-uat.domain.com
. To enable this I have substituted the domains by environment variables and used the following command in the docker-compose.yaml
file:
command: /bin/bash -c "envsubst < /etc/nginx/user_conf.d/ssl-server.conf.template > /etc/nginx/user_conf.d/ssl-server.conf && nginx -g 'daemon off;'
This produces the correct ssl_server.conf
file but does not seem to start the certbot
process.
I'm trying to figure out if using a command in the docker-compose.yaml
overrules the RUN
command in the Dockerfile but cannot find anything to say that.
I'm also trying to trigger the run command from within the docker-compose.yaml
file like.
command: /bin/bash -c "envsubst < /etc/nginx/user_conf.d/ssl-server.conf.template > /etc/nginx/user_conf.d/ssl-server.conf && nginx -g 'daemon off;' && /scripts/start_nginx_certbot.sh"
But this does not make a difference.
What am I missing?
Upvotes: 1
Views: 228
Reputation: 25389
Your command overrides the command in the image, so you need to run the startup script yourself as you show in your last command.
I think your error in that is that you also run nginx. When you do it that way, your 'base' nginx starts and since it doesn't exit, the normal startup script is never run. Try this
command: /bin/bash -c "envsubst < /etc/nginx/user_conf.d/ssl-server.conf.template > /etc/nginx/user_conf.d/ssl-server.conf && /scripts/start_nginx_certbot.sh"
Upvotes: 1