Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Following symlinks when docker-entrypoint.sh starts. #731

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

walkure
Copy link

@walkure walkure commented Dec 18, 2022

Some k8s implentations (I use k0s v1.25.2+k0s.0) use symlinks when mounting ConfigMap as volume.

image

Following find supports symbolic linked contents. But the first find does not follow symlinks, it is not processed.

find "/docker-entrypoint.d/" -follow -type f -print | sort -V | while read -r f; do


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

@profiprog
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants