Docker Community Forums

Share and learn in the Docker community.

Permission Denied when try to run mysql container

I’ve an error, when I try to build a container based on mysql:5.7, my host machine is a Fedora 32.

Docker version 19.03.11, build 42e35e6
docker-compose version 1.25.4, build unknown

My docker-compose.yml

version: '3'
    container_name: db_mysql
    image: mysql:5.7
      - "33062:3306"
      - "MYSQL_ROOT_PASSWORD=123456789"
      - "./db/mysql/data:/var/lib/mysql"
      - "./db/mysql/initdb.d:/docker-entrypoint-initdb.d"
      - backend
    driver: bridge

When I run the following command, docker-compose exited with code 2
sudo docker-compose up --build --force-recreate

The logs are:

$ sudo docker-compose up --build --force-recreate 
Recreating db_mysql ... 
WARNING: Service "mysql" is using volume "/var/lib/mysql" from the previous container. Host mapping "/home/patrickacioli/Documents/Development/projects/traderclub/traderclub/app/db/mysql/dataRecreating db_mysql ... done
Attaching to db_mysql
db_mysql | 2020-06-29 02:13:40+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 5.7.30-1debian10 started.
db_mysql | 2020-06-29 02:13:40+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
db_mysql | 2020-06-29 02:13:40+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 5.7.30-1debian10 started.
db_mysql | ls: cannot open directory '/docker-entrypoint-initdb.d/': Permission denied
db_mysql exited with code 2

I new with the docker, but I try to learning that. I searching about this error in the last hours, but I can’t find anything about this. I hope do find help here.

Best Regards


Output of docker version:
Version: 18.06.0-ce
API version: 1.25 (downgraded from 1.38)
Go version: go1.10.3
Git commit: 0ffa825
Built: Wed Jul 18 19:05:28 2018
OS/Arch: windows/amd64
Experimental: false

Version: 1.5.2
API version: 1.25 (minimum version 1.19)
Go version: go1.8.6
Git commit: 30b67a14
Built: Thu Mar 14 09:33:31 2019
OS/Arch: linux/amd64
Experimental: true

Output of docker info:
Containers: 10
Running: 9
Paused: 0
Stopped: 1
Images: 20
Server Version: v1.5.2-20879-30b67a14
Storage Driver: vSphere Integrated Containers v1.5.2-20879-30b67a14 Backend Engine
VolumeStores: default
vSphere Integrated Containers v1.5.2-20879-30b67a14 Backend Engine: RUNNING
VCH CPU limit: 161904 MHz
VCH memory limit: 1.274 TiB
VCH CPU usage: 26793 MHz
VCH memory usage: 539.2 GiB
VCH storage usage: 104.1 GiB
VCH images storage usage: 7.621 GiB
VCH containers storage usage: 96.51 GiB
VMware Product: VMware vCenter Server
VMware OS: linux-x64
VMware OS version: 6.5.0
Registry Whitelist Mode: disabled. All registry access allowed.
Volume: vsphere
Network: bridge vic-container-network
Swarm: inactive
Operating System: linux-x64
OSType: linux-x64
Architecture: x86_64
CPUs: 161904
Total Memory: 1.274TiB
ID: vSphere Integrated Containers
Docker Root Dir:
Debug Mode (client): false
Debug Mode (server): false
Experimental: false
Live Restore Enabled: false

Output of docker-compose version (if applicable):
docker-compose version 1.22.0, build f46880fe
docker-py version: 3.4.1
CPython version: 3.6.6
OpenSSL version: OpenSSL 1.0.2o 27 Mar 2018

Additional environment details (AWS, VirtualBox, Docker for MAC, physical, etc.):

VMware integrated containers v1.5.2-7206
Storage volume is NFS mounted (does require chown for non-root permissions for mounted data. Should not apply to mysqld.log mapped to stdout)