yobasystems / alpine-mariadb

MariaDB running on Alpine Linux [Docker]
https://hub.docker.com/r/yobasystems/alpine-mariadb/
237 stars 71 forks source link

Initializing a fresh instance #17

Closed jozo closed 5 years ago

jozo commented 5 years ago

Official image for mariadb has this very handy feature about initializing database from mounted volume. Can you please add it to this image?

https://hub.docker.com/_/mariadb/

When a container is started for the first time, a new database with the specified name will be created and initialized with the provided configuration variables. Furthermore, it will execute files with extensions .sh, .sql and .sql.gz that are found in /docker-entrypoint-initdb.d. Files will be executed in alphabetical order. You can easily populate your mariadb services by mounting a SQL dump into that directory and provide custom images with contributed data. SQL files will be imported by default to the database specified by the MYSQL_DATABASE variable.

jozo commented 5 years ago

@dominictayloruk thank you for the commit. But it gives me an error: /scripts/run.sh: line 90: syntax error: bad substitution

I think you have undefined variable mysql in that script.

Also, if I understand correctly, it will try to run scripts for the initialization every time it starts.