How do I initialize a mysql container with a mysql .sql script file or how to I add a database and save the image?

I am interested in saving an image file with MySQL running a database that I have defined in a MySQL .sql script file. How would I go about doing this please?

Thanks,

Wex

Hi :slight_smile:

Take a look at this:

This will create a image from a running container.

You can create a new image FROM https://hub.docker.com/_/mariadb/ and COPY your .sql file to /dcoker-entrypoint-initidb.d/ :

FROM mariadb

COPY MySQL.sql /docker-entrypoint-initdb.d/
1 Like