0

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.

MatiasGdo
  • 3
  • 3
  • can you use a named volume for the `/bitnami/mariadb` rather than an explicit path? I'm hoping this starts with a friendlier permissions but I haven't tested this. – danblack May 09 '23 at 03:44
  • Searching for your error msg turns up some other questions about it here on SO, have you seen those? Some for the same image, some for other Bitnami images. This one seems to have a solution? https://stackoverflow.com/questions/69795804/mariadb-galera-on-minikube-mkdir-cannot-create-directory-bitnami-mariadb-dat – Don't Panic May 09 '23 at 06:50
  • It was an permissions thing, like Zagreus said too, thanks! – MatiasGdo May 09 '23 at 13:59

2 Answers2

0

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

Zagreus
  • 86
  • 5
0

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.

Severalnines
  • 106
  • 5