-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
docker-entrypoint.sh: executable shell script test is unreliable #1108
Comments
We had a similar issue in docker-library/mysql#862; no great conclusion there 😞. I'd rather not introduce hacky/fragile code when To work around it, you can build an image |
Yeah, I'd not be keen on adding the workaround to replace I went with your suggestion in our code. For those who run into this issue the changes came down to the following:
|
I'd love to figure out where/why |
docker-entrypoint.sh
uses a.sh
file's executable mode to decide whether to source or exec the shell script. Due to a long-standing issue on Docker Desktop for macOS when VirtioFS or gRPC FUSE are used all files mounted into the container from the host are executable according totest -x
even if the executable bit is not set, so this test is unreliable. As a result non-executable scripts in/docker-entrypoint-initdb.d
are executed, giving aPermission denied
error and the script does not run.Although this really needs fixing in Docker Desktop, it's potentially going to lead to hard-to-diagnose issues in Postgres initialisation so I thought it at least worth reporting here for visibility. A possible workaround for the Docker issue could be to use
stat
andgrep
: something likeif stat -c '%A' "$f" | grep -q '^-..x'; then ...
.The text was updated successfully, but these errors were encountered: