I’m making my final proyect for my final studies and I’ve encountered a doubt without so much information about it.
I’m making an horizontal scaling Nginx with MariaDB Galera network with Ansible and Docker-Compose, where I have 3 containers of bitnami/mariadb-galera and want to have an persistant database, where all the times I ran the containers, the data won’t be lost.
I’ve read information about it in the mariadb-galera page from Docker, in the "Persisting your database" part, but, I can’t understand how can I do that. This is how I’m writing it into my file docker-compose.yml:
volumes:
- /home/ansible/docker/mariadb/:/bitnami/mariadb
But, in the docker logs (docker logs container_name
) this error appears:
mkdir: cannot create directory '/bitnami/mariadb/data': Permission denied
I hope someone could help me about Persistance in MariaDB Galera, thank you for reading.
2
Answers
you are running a non-root-container in openshift and you need to check the permissions.
"Because of this, the non-root images cannot have configuration specific to the user running the container. From this point to the end of the Dockerfile, everything is run by the 1001 user." running-non-root-containers-on-openshift
Just to add on what @zegreus have answered, it is best to not place your volumes in docker container and avoid using /home. My recommendation is try to use other directories. For example, /opt/mariadb where your /bitnami/mariadb is assigned.