docker-nginx
docker-nginx copied to clipboard
Following symlinks when docker-entrypoint.sh starts.
Some k8s implentations (I use k0s v1.25.2+k0s.0) use symlinks when mounting ConfigMap as volume.

Following find supports symbolic linked contents. But the first find does not follow symlinks, it is not processed.
https://github.com/nginxinc/docker-nginx/blob/5ce65c3efd395ee2d82d32670f233140e92dba99/entrypoint/docker-entrypoint.sh#L17
Since find (L17) includes dotdirs when following symlinks, found shell scripts are evaluated multiple times (at my environment.).
Excluding dotdirs(like below) will resolve it , but I'm afraid of breaking backward compatibility.
find "/docker-entrypoint.d/" -follow -type d -name '.*' -prune -o -type f -print
I also have issue related whit this. I use image in kubernetes and mount Config into /docker-entrypoint.d/.
Structure looks like:
# tree /docker-entrypoint.d/ -a
/docker-entrypoint.d/
├── ..2023_01_16_13_30_24.2292211062
│ └── setup-data.sh
├── ..data -> ..2023_01_16_13_30_24.2292211062
└── setup-data.sh -> ..data/setup-data.sh
And command: /usr/bin/find "/docker-entrypoint.d/" -mindepth 1 -maxdepth 1 -type f -follow -print -quit
requires option -follow to work as expected.
However command: find "/docker-entrypoint.d/" -follow -type f -print
also needs options -mindepth 1 -maxdepth 1
# find "/docker-entrypoint.d/" -follow -type f -print
/docker-entrypoint.d/..data/setup-data.sh
/docker-entrypoint.d/setup-data.sh
/docker-entrypoint.d/..2023_01_16_13_30_24.2292211062/setup-data.sh
# find "/docker-entrypoint.d/" -follow -mindepth 1 -maxdepth 1 -type f -print
/docker-entrypoint.d/setup-data.sh