I'm having trouble in configuring persistent data with Mariadb.
I'm using docker-compose, with each service in a single container (Nginx, PHP-FPM and Mariadb).
Everything is working, except Mariadb doesn't store data. Every time I restart the container, I lose all the data. Then I found out that I can use another container just to keep data, and it doesn't even have to be running.
So I'm using, in Mariadb container volume_from content container. But when I do that, when I try to map the volume /var/lib/mysql, the Container MariaDb doesn't start.
Error
2015-12-29 12:16:40 7f2f02e4a780
InnoDB: Operating system error number 13 in a file operation.
InnoDB: The error means mysqld does not have the access rights to
InnoDB: the directory.
The error refers to a problem about volume permissions, but I've tried to set permissions through Dockerfile in both containers, and the problem persists. I'm a bit lost. I'm using OSX, so I believe this is an OSX problem. Can anyone help me on this?
This is my code:
My Docker Compose
content:
build: containers/content
container_name: content
hostname: content
volumes:
- /var/lib/mysql
mariadb:
build: containers/mariadb
container_name: mariadb
hostname: mariadb
ports:
- "3306:3306"
volumes_from:
- content
environment:
- MYSQL_ROOT_PASSWORD=mariadb
- TERM=xterm
- PORT=3306
MariaDB Dockerfile
FROM debian:jessie RUN apt-get update && apt-get install -y mariadb-server EXPOSE 3306
Content Dockerfile
FROM debian:jessie VOLUME /var/lib/mysql CMD ["true"]