0

I'm using this in my Dockerfile, without CMD or ENTRYPOINT. I'm relying on the underlying nginx official image's docker-entrypoint.sh

FROM nginx:1.18

I've tried in my docker-compose to add the following command but it just keeps restarting and no error msg.

command: >
    sh -c 'echo "My Own Command" && /usr/sbin/nginx -g "daemon off;"'

It will work fine if I remove the command from my docker-compose.yml.

My final objective is to add some scripts so I can export secrets to my environment variable but I couldn't get the underlying docker-entrypoint.sh or nginx-g "daemon off;" command running and keeping the container going.

2
  • 1
    Your command works with nginx:latest but not with nginx:1.18. There are some differences in how the images are built (1.18 doesn't have a docker-entrypoint.sh script for instance). Can you use the latest version or does it have to be 1.18? Jul 18, 2021 at 22:24
  • i am using ubuntu 18.04 and it comes with 1.18 nginx and we didn’t upgrade because we don’t want to break things. i will give the latest a go and see if it works! thank you very much! Jul 21, 2021 at 10:06

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.