sclorg / mysql-container

MySQL container images based on Red Hat Software Collections and intended for OpenShift and general usage. Users can choose between Red Hat Enterprise Linux, Fedora, and CentOS based images.
http://softwarecollections.org
Apache License 2.0
128 stars 201 forks source link

Is it possible to create more than one database when init container? #286

Open EKwongChum opened 4 years ago

EKwongChum commented 4 years ago

While we use this resposity's image mysql-57-centos7 ,we want to create more than one database when init container. Is it possible to run some commands like

docker container run --detach --name mysql_database -e MYSQL_USER=myuser -e MYSQL_PASSWORD=pass -e MYSQL_DATABASE=db1,db2,db3 -p 3306:3306 mysql-57-centos7:latest

to create three databases: db1, db2 and db3 when init container?

hhorak commented 3 years ago

It is possible to extend the image by mounting some SQL query and a script to a proper place or building you own layer on top of the image. See the "Extending image" section in the doc: https://github.com/sclorg/mysql-container/tree/master/8.0#extending-image

hhorak commented 3 years ago

Well, the suggested approach in #287 might be actually a nice enhancement. We'll consider it.