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

docker-entrypoint.sh: permission denied #636

Closed
kekec777 opened this issue Feb 13, 2020 · 16 comments
Closed

docker-entrypoint.sh: permission denied #636

kekec777 opened this issue Feb 13, 2020 · 16 comments
Labels
question Usability question, not directly related to an error with the image

Comments

@kekec777
Copy link

kekec777 commented Feb 13, 2020

Hello forum
Im quite new to docker and ran into some problem with mysql:
I have a docker-compose file where i have:

mysql:

    image: mysql
    command: --default-authentication-plugin=mysql_native_password
    container_name: mysql
    restart: unless-stopped
    networks:
     DockerNet:
       ipv4_address: 192.168.1.58
    volumes:
      - /sharedfolders/docker/config/mysql/:/var/lib/mysql
    environment:
      - MYSQL_ROOT_PASSWORD=*****
      - MYSQL_PASSWORD=*****
      - MYSQL_DATABASE=*****
      - MYSQL_USER=*****
      - PUID=0
      - PGID=0
    ports:
      - 3306:3306

but when i compose it , i get this error in log:

2020-02-13 14:00:02+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.19-1debian9 started.
2020-02-13 14:00:02+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
error: exec: "/usr/local/bin/docker-entrypoint.sh": stat /usr/local/bin/docker-entrypoint.sh: permission denied
2020-02-13 14:00:03+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.19-1debian9 started.
2020-02-13 14:00:03+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
error: exec: "/usr/local/bin/docker-entrypoint.sh": stat /usr/local/bin/docker-entrypoint.sh: permission denied
2020-02-13 14:00:03+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.19-1debian9 started.
2020-02-13 14:00:03+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
error: exec: "/usr/local/bin/docker-entrypoint.sh": stat /usr/local/bin/docker-entrypoint.sh: permission denied
2020-02-13 14:00:04+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.19-1debian9 started.
2020-02-13 14:00:04+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
error: exec: "/usr/local/bin/docker-entrypoint.sh": stat /usr/local/bin/docker-entrypoint.sh: permission denied
2020-02-13 14:00:06+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.19-1debian9 started.
2020-02-13 14:00:06+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
error: exec: "/usr/local/bin/docker-entrypoint.sh": stat /usr/local/bin/docker-entrypoint.sh: permission denied
2020-02-13 14:00:08+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.19-1debian9 started.
2020-02-13 14:00:08+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
error: exec: "/usr/local/bin/docker-entrypoint.sh": stat /usr/local/bin/docker-entrypoint.sh: permission denied
2020-02-13 14:00:12+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.19-1debian9 started.
2020-02-13 14:00:12+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
error: exec: "/usr/local/bin/docker-entrypoint.sh": stat /usr/local/bin/docker-entrypoint.sh: permission denied

Any idea, whats going on?

@wglambert wglambert added the question Usability question, not directly related to an error with the image label Feb 13, 2020
@wglambert
Copy link

The permissions on /sharedfolders/docker/config/mysql/ need to allow the mysql user full access.
The mysql user has UID 999 so granting ownership to the host user that also has UID 999 would work. Or just set 777 permissions on the folder and its contents

Or a Docker named volume would work but you can't necessarily pre-populate it with files

@yosifkit
Copy link
Member

I'm confused. It looks like it is failing to access docker-entrypoint.sh after re-execing to the mysql user. Did you build the image yourself? The best way to do so is to git clone the repo, just downloading the Dockerfile and entrypoint script usually misses permissions.

Perhaps you have the same problem as moby/moby#34644?

We don't have anything in the image to take use of PUID/GUID (we recommend just using --user on docker run or equivalent), so this seems more like https://hub.docker.com/r/linuxserver/mysql

@kekec777
Copy link
Author

kekec777 commented Feb 14, 2020

The permissions on /sharedfolders/docker/config/mysql/ need to allow the mysql user full access.
The mysql user has UID 999 so granting ownership to the host user that also has UID 999 would work. Or just set 777 permissions on the folder and its contents

Or a Docker named volume would work but you can't necessarily pre-populate it with files
@wglambert
Changing the folder with chmod 777 didnt work
Giving the folder chown -R 999:users didnt work
And 999 in my OMV is the openmediavault-webgui user , dont know if thats a problem?

@kekec777
Copy link
Author

I'm confused. It looks like it is failing to access docker-entrypoint.sh after re-execing to the mysql user. Did you build the image yourself? The best way to do so is to git clone the repo, just downloading the Dockerfile and entrypoint script usually misses permissions.

Perhaps you have the same problem as moby/moby#34644?

We don't have anything in the image to take use of PUID/GUID (we recommend just using --user on docker run or equivalent), so this seems more like https://hub.docker.com/r/linuxserver/mysql

@yosifkit

hmm i dont build the image, i just pull it with docker-compose
So it should be the same as git clone.

moby/moby#34644? - i have tried to change to folders permission like he metionted but that dindt work - same log error

Update: when i add the user: mysql
i get this compose error msg:

Creating mysql ... error

ERROR: for mysql Cannot start service mysql: OCI runtime create failed: container_linux.go:349: starting container process caused "exec: "docker-entrypoint.sh": executable file not found in $PATH": unknown

ERROR: for mysql Cannot start service mysql: OCI runtime create failed: container_linux.go:349: starting container process caused "exec: "docker-entrypoint.sh": executable file not found in $PATH": unknown
ERROR: Encountered errors while bringing up the project.

@wglambert
Copy link

Are you using Docker for Win/Mac

Maybe it's a corrupt image, try docker image rm mysql and re-pulling?

The error OCI runtime create failed: container_linux.go:349 only has one result in Google opencontainers/runc#1980 but seems unrelated

@wglambert
Copy link

Did you make any progress on this issue?

@kekec777
Copy link
Author

Did you make any progress on this issue?

@wglambert
Im on a buisness trip so could not resolve the issue or test further ..
But the last time I tried, i still had the issue with permission...

and i tried to pull the image or re pulling it. - no difference.

@kekec777
Copy link
Author

kekec777 commented Mar 6, 2020

SOLVED!
After reinstalling OMV5 / DEBIAN 10 it worked - can't explained it , but now it works...

@tianon
Copy link
Member

tianon commented Mar 6, 2020

Awesome, glad you got it working 👍

@tianon tianon closed this as completed Mar 6, 2020
@ThomasRedstone
Copy link

I believe this is a wider issue, I've suddenly started getting this on all my containers, it was not limited to mysql, I've re-installed docker using apt instead of snap, and it seems to be resolved.

.

@thiagola92
Copy link

thiagola92 commented May 24, 2020

@ThomasRedstone Thank you!
All containers stop working, uninstalling docker from snap and installing with apt solved

EDIT: For the record, running Ubuntu 20.04

@IvoPereira
Copy link

I've faced the same issue with several different containers (mariadb included) and the workaround of uninstalling docker through snap and reinstalling through apt solved it.

For the record, running Ubuntu 18.04.

@henninglive
Copy link

It’s probably related to this issue with the docker snap:
https://forum.snapcraft.io/t/docker-fails-with-permission-denied-inside-containers/17602/21
https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1879690

As mentioned, a workaround is to uninstall the docker snap and reinstall docker with apt.

sudo snap remove docker
sudo apt-get install docker.io docker-compose

@netcyrax
Copy link

netcyrax commented Jun 2, 2020

Same here. Uninstalling Snap, installing apt-get docker worked.

In case sudo snap remove docker gets stuck, try sudo snap remove --purge docker

@grooverdan
Copy link

Another possibility that I encountered was the git clone left the entrypoint with a -rwx------ permission. On build it had the same permissions inside the container resulting in:

root@731e713b5427:/# ls -la /usr/local/bin/docker-entrypoint.sh
-rwx------. 1 root root 14354 Jul  7 04:36 /usr/local/bin/docker-entrypoint.sh

root@731e713b5427:/# exec gosu mysql /usr/local/bin/docker-entrypoint.sh mysqld
error: exec failed: permission denied
``

@vmerz
Copy link

vmerz commented Oct 21, 2022

My host is on macOS, I had the same issue. I had to set the following to work around the error:

user: "1000"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Usability question, not directly related to an error with the image
Projects
None yet
Development

No branches or pull requests