docker-library / postgres

Docker Official Image packaging for Postgres
http://www.postgresql.org
MIT License
2.19k stars 1.14k forks source link

Synology: exec failed: permission denied #1002

Closed Grimgog closed 2 years ago

Grimgog commented 2 years ago

Dear community,

I've recently setup the /15/bullseye dockerfile on my synologystation DS920+ (os version: DSM 7.1-42661 Update 4). I added my user "admin" to docker group via "sudo synogroup --add docker admin" and restartd thus my user "admin" is capable to run docker.

Then I used following docker build and run command: docker build -f Dockerfile -t postgres-docker . && docker run -p <my-ip>:6543:5432 --env POSTGRES_USER=postgres-docker --env POSTGRES_DB=postgres-docker --env POSTGRES_PASSWORD=<mysecretpassword> --name postgres-docker postgres-docker

The image builds well but then docker run fails the container with following message: Successfully tagged postgres-docker:latest error: exec failed: permission denied

So, does someone has the same problem and knows how to fix? Is it the user that is being created in debian that causes the problems?

wglambert commented 2 years ago

It might be some permissions issue with the Dockerfile you're building, since we've never had this specific error come up in the Postgres repo before. Can you give all the commands you ran and any relevant files or logs for reproducing the issue

Grimgog commented 2 years ago

Yes, I can provide you additional information of course. Generally one has to say that Synology itself runs also a postgres internally, so one can't use port 5432 for the device. Thus intern in the container 5432 has to be mapped/binded into another port (here e.g. 6543)

How to reproduce:

After that docker creates the image and the container. But on docker run the container only outputs error: exec failed: permission denied.

To sum this up it could be either the user permission inside the dockerfile or the problems with the postgres running on the synology os itself.

wglambert commented 2 years ago

More specifically what's the Dockerfile for postgres-docker as it's going to have some difference from the Official Image proper. And the full docker logs output for the container when it fails as that could highlight a specific step that it's failing on

tianon commented 2 years ago

Any particular reason you're building from source instead of pulling the pre-built image?

Also, to build the image, you'll want to git clone instead of just copying the files (or else you'll miss permissions bits, which are likely going to cause errors similar to the one you've posted).

Grimgog commented 2 years ago

So, I tried the pre-built image, like tianon suggested. And it worked out of the box!

Closed.