MariaDB / mariadb-docker

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

remove VOLUME to allow building images with data #495

Closed mdobrzanski closed 1 year ago

mdobrzanski commented 1 year ago

Could you remove instruction VOLUME from Dockerfile?

https://github.com/MariaDB/mariadb-docker/blob/master/10.4/Dockerfile#L134

That would allow to build images based on official image with custom data in it. Like a snapshot of a customized database. This way it could be used as a starting point e.g. has users and schema. Very useful for testing when containers from customized image has test data already in it.

I believe it will be still possible to attach volume.

grooverdan commented 1 year ago

I need to think a lot more on the implications of this.

An alternate for you is creating a /var/lib/customapp and using this, and drop a config file

[mariadb]
datadir=/var/lib/customapp

in /etc/mysql/mariadb.conf.d/01_customapp.cnf

grooverdan commented 1 year ago

While looking at MDEV-30728 I was reminded that non-Volume mounts are overlayfs in Docker/container runtime implementations, which has implications like MDEV-28751, which until resolved (in MariaDB or kernel), would need innodb_flush_method = fsync to avoid the error.

I don't think I can implement your desired change without significantly impacting many other people who use non-explicit volumes. I hope my work around above is useful for you.