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?
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
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 https://github.com/moby/moby/issues/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
The permissions on
/sharedfolders/docker/config/mysql/need to allow themysqluser full access.
Themysqluser 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 contentsOr 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?
I'm confused. It looks like it is failing to access
docker-entrypoint.shafter re-execing to themysqluser. Did you build the image yourself? The best way to do so is togit clonethe 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--userondocker runor 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.
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 https://github.com/opencontainers/runc/issues/1980 but seems unrelated
Did you make any progress on this issue?
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.
SOLVED!
After reinstalling OMV5 / DEBIAN 10 it worked - can't explained it , but now it works...
Awesome, glad you got it working 馃憤
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.
.
@ThomasRedstone Thank you!
All containers stop working, uninstalling docker from snap and installing with apt solved
EDIT: For the record, running Ubuntu 20.04
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.
It鈥檚 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
Same here. Uninstalling Snap, installing apt-get docker worked.
In case sudo snap remove docker gets stuck, try sudo snap remove --purge docker
Most helpful comment
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.
.