docker-nginx-unprivileged: v1.18 failed with config file mounted
I have a project that has nginx in my docker-compose like this:
nginx:
image: nn-docker.artifactory.prd.ss.aws.insim.biz/nginxinc/nginx-unprivileged:1.18-alpine
ports:
- "8081:8081"
volumes:
- "./../etc/nginx.conf:/etc/nginx/nginx.conf"
But on v1.18 i am getting the following errors:
/docker-entrypoint.sh: /docker-entrypoint.d/ is not empty, will attempt to perform configuration
/docker-entrypoint.sh: Looking for shell scripts in /docker-entrypoint.d/
/docker-entrypoint.sh: Launching /docker-entrypoint.d/10-listen-on-ipv6-by-default.sh
10-listen-on-ipv6-by-default.sh: Getting the checksum of /etc/nginx/conf.d/default.conf
10-listen-on-ipv6-by-default.sh: Enabled listen on IPv6 in /etc/nginx/conf.d/default.conf
/docker-entrypoint.sh: Launching /docker-entrypoint.d/20-envsubst-on-templates.sh
/docker-entrypoint.sh: Launching /docker-entrypoint.d/30-configure-nginx-unprivileged.sh
sed: can't move '/etc/nginx/nginx.confMDbjOE' to '/etc/nginx/nginx.conf': Resource busy
Going back to version 1.17.x works fine. What is the issue here? Am I configuring something incorrectly or is this a bug?
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 8
- Comments: 28
Commits related to this issue
- Downgrade nginx to legacy version 1.16 - bug https://github.com/nginxinc/docker-nginx-unprivileged/issues/37 — committed to universe-42/docker-prodigy by universe-42 4 years ago
- Upgrade nginx to version 1.17 (continuous problem) - bug https://github.com/nginxinc/docker-nginx-unprivileged/issues/37 — committed to universe-42/docker-prodigy by universe-42 4 years ago
Thank you looking into this. I tested the mounting of configmap in k8s - and still see issue there. I have a mounting snippet like:
where the file in the configmap replaces the default.conf.
The other case where we use the image as a base and add default.conf in Dockerfile seems to work with the test image. Not seeing issues with port 808080.
I’m seeing similar behavior all of a sudden in our containers as well.
I’m looking into it a the moment. The simple reason seems to be that the volume mount prevents the last entrypoint script from being run correctly (the entrypoint script should not modify files you’ve mounted in a volume). Let me try to look into it and see what can be done. 1.17.10 should work for the time being.
Explicitly adding CMD [ “/bin/bash”, “-c”, “nginx -g ‘daemon off;’” ] to my Dockerfile helped me to solve the problem. My configMap with default.conf is now injected correctly.
docker run nginx /docker-entrypoint.sh: /docker-entrypoint.d/ is not empty, will attempt to perform configuration /docker-entrypoint.sh: Looking for shell scripts in /docker-entrypoint.d/ /docker-entrypoint.sh: Launching /docker-entrypoint.d/10-listen-on-ipv6-by-default.sh 10-listen-on-ipv6-by-default.sh: Getting the checksum of /etc/nginx/conf.d/default.conf 10-listen-on-ipv6-by-default.sh: Enabled listen on IPv6 in /etc/nginx/conf.d/default.conf /docker-entrypoint.sh: Launching /docker-entrypoint.d/20-envsubst-on-templates.sh /docker-entrypoint.sh: Configuration complete; ready for start up
Same behaviour from my side as well
Status: Downloaded newer image for nginx:latest /docker-entrypoint.sh: /docker-entrypoint.d/ is not empty, will attempt to perform configuration /docker-entrypoint.sh: Looking for shell scripts in /docker-entrypoint.d/ /docker-entrypoint.sh: Launching /docker-entrypoint.d/10-listen-on-ipv6-by-default.sh 10-listen-on-ipv6-by-default.sh: Getting the checksum of /etc/nginx/conf.d/default.conf 10-listen-on-ipv6-by-default.sh: Enabled listen on IPv6 in /etc/nginx/conf.d/default.conf /docker-entrypoint.sh: Launching /docker-entrypoint.d/20-envsubst-on-templates.sh /docker-entrypoint.sh: Configuration complete; ready for start up
Container log is:
I can reproduce with attached yaml:
test.yaml.txt