Here I created docker container which use the mariadb
image and created three volumes as below.
docker-compose.yml
version: '2.0'
services:
mariadb:
image: mariadb:latest
restart: always
container_name: mariadb
environment:
- MYSQL_ROOT_PASSWORD=root
- MYSQL_DATABASE=testdb
ports:
- 3307:3306
volumes:
- ./database:/var/lib/mysql
- ./_conf/mariadb.cnf:/etc/mysql/my.cnf:ro
- ./logs:/var/log/mysql
First two volume works successfully but I can't able to find mariadb-logs files into logs
folder. I seems logs
folder showing blank on host as well as on container(/var/log/mysql). I think host folder override into docker file system.
If I remove this volume(./logs:/var/log/mysql
) from docker-compose then logs files are showing on container.
My plan is to mount /var/log/mysql/
folder to local machine.
Thanks !
chmod 777 /var/log/mysql
on your host, I bet your daemon running asmysql
user has no rights to write in this directory on your host. After that you'll have to find the mysql user id inside the container to make achown
to avoid lettign everyone read an write your db logs.Debian
os and apparmor already deactivate.