How to fix bitnami mariadb 'mkdir: cannot create directory '/bitnami/mariadb': Permission denied'
Problem:
You are trying to run a docker bitnami/mariadb container but when you try to start it up, you see an error message like
output.txt
mariadb_1 | mkdir: cannot create directory '/bitnami/mariadb': Permission deniedSolution
bitnami containers mostly are non-root-containers, hence you need to adjust the permissions for the data directory mapped onto the host.
First, find out what directory your /bitnami is mapped to on the host. For example, for
docker-compose.yml
services:
mariadb:
image: 'bitnami/mariadb:latest'
environment:
- ALLOW_EMPTY_PASSWORD=yes
volumes:
- '/var/lib/my_docker/mariadb_data:/bitnami'it is mapped to /var/lib/my_docker/mariadb_data.
Now chown this directory to 1001:1001 since the image is using UID 1001 as the user running the command:
chown.sh
sudo chown -R 1001:1001 [directory]for example
chown.sh
sudo chown -R 1001:1001 /var/lib/my_docker/mariadb_dataCheck out similar posts by category:
Docker
If this post helped you, please consider buying me a coffee or donating via PayPal to support research & publishing of new posts on TechOverflow