MariaDB / mariadb-docker

Docker Official Image packaging for MariaDB
https://mariadb.org
GNU General Public License v2.0
759 stars 438 forks source link

How to unmount docker-entrypoint-initdb.d from a Mariadb container #450

Closed fulwang closed 2 years ago

fulwang commented 2 years ago

Want to read & execute a initialization sql file mounted in docker-entrypoint-initdb.d directory and persist Mariadb data to named volume, and it succeeded. But then how to remove the mapped volume mounted on docker-entrypoint-initdb.d directory after that? now, when i restart the container, i can see the mapped volume still mounted through the docker inspect command.


docker run -d --name perfdb02 -e MARIADB_DATABASE='pkt' -e MARIADB_USER='puser' -e MARIADB_PASSWORD='test' -e MARIADB_ROOT_PASSWORD='654321' -v /Users/fulwang/seed:/docker-entrypoint-initdb.d/ -v vol_mysql01:/var/lib/mysql mariadb:latest

grooverdan commented 2 years ago

Instead of restarting the container, stop the container, and start a new container on the same vol_mysql01 volume. Env variables and /dcoker-entrypoint-initdb.d volume are no longer required.

fulwang commented 2 years ago

Many Thanks @grooverdan !