Hello, since I’m new to while docker
thing, I have some issues on setting up containers.
I want to set up mariadb
container in a Laravel project. This is from my docker-compose.yml
file
mysql-db:
image: mariadb:10.4.6-bionic
container_name: mysql-db
volumes:
- ./run/var:/var/lib/mysql:Z
environment:
- MYSQL_DATABASE=${DB_DATABASE}
- MYSQL_USER=${DB_USERNAME}
- MYSQL_PASSWORD=${DB_PASSWORD}
ports:
- 3306:3306
networks:
backend:
aliases:
- db
networks:
backend:
name: backend-network
But when i run docker-compose up
I get this errors.
mysql-db | find: '/var/lib/mysql/': Permission denied
mysql-db | chown: changing ownership of '/var/lib/mysql/': Permission denied
mysql-db exited with code 1
I think it is problem with SELinux, as I had permission denied problems with my php-apache container. And I solved them by adding Z at the end of volumes line. I tried that here too, but it doesn’t seem to work.
Does anyone have idea on what to try next?
Thanks in advance