We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I am using postgres:17 image, and in my docker-compose.yml file I have added:
postgres:17
docker-compose.yml
volumes: - pgdata:/var/lib/postgresql/data - ../init-db.sh:/docker-entrypoint-initdb.d/init-db.sh
The ../init-db.sh does not have the executable mode on the host:
../init-db.sh
-rw-r--r--@ 1 myuser staff 2218 14 Mar 14:02 init-db.sh
so it is expected to be sourced, but instead the container initialization is trying to execute it
/usr/local/bin/docker-entrypoint.sh: running /docker-entrypoint-initdb.d/init-db.sh /usr/local/bin/docker-entrypoint.sh: line 174: /docker-entrypoint-initdb.d/init-db.sh: Permission denied
I have created a container to check what is going on
% docker run --rm -it -e POSTGRES_HOST_AUTH_METHOD=trust -v ./init-db.sh:/docker-entrypoint-initdb.d/init-db.sh postgres:17 bash root@f7ca7450b9d2:/# cd docker-entrypoint-initdb.d/ root@f7ca7450b9d2:/docker-entrypoint-initdb.d# ls -la total 12 drwxr-xr-x 1 root root 4096 Mar 17 13:04 . drwxr-xr-x 1 root root 4096 Mar 17 13:04 .. -rw-r--r-- 1 root root 2218 Mar 14 14:02 init-db.sh root@f7ca7450b9d2:/docker-entrypoint-initdb.d# [ -x init-db.sh ] && echo $? 0 root@f7ca7450b9d2:/docker-entrypoint-initdb.d#
so strangely the test [ -x init-db.sh ] is failing: it should have returned 1 !
[ -x init-db.sh ]
1
Old issues related to this: #490 #452
The expected behavior is for the init-db.sh script to be sourced, not executed.
init-db.sh
The text was updated successfully, but these errors were encountered:
I'm guessing you're on macOS using Docker Desktop? IIRC, the file sharing implementation there has a quirk where test -x returns the wrong answer.
test -x
Sorry, something went wrong.
Aha, there it is; this is a duplicate of #1108
@tianon
I'm guessing you're on macOS using Docker Desktop? Yes.
Sorry, that other issue was not caught in my search.
My solution (workaround) was to chmod +x init-db.sh, and move on ...
chmod +x init-db.sh
No branches or pull requests
I am using
postgres:17
image, and in mydocker-compose.yml
file I have added:The
../init-db.sh
does not have the executable mode on the host:-rw-r--r--@ 1 myuser staff 2218 14 Mar 14:02 init-db.sh
so it is expected to be sourced, but instead the container initialization is trying to execute it
I have created a container to check what is going on
so strangely the test
[ -x init-db.sh ]
is failing: it should have returned1
!Old issues related to this: #490 #452
The expected behavior is for the
init-db.sh
script to be sourced, not executed.The text was updated successfully, but these errors were encountered: