Can't commit MySQL image


I pulled out a MySQL image ( and, once I started the container, I created a new database and I commited this modification with the container filesystem.
But stoping and restarting the container, the new database doesn’t appear and I need to create it again and again. What did I miss here ?
Many thanks in advance,


The database is kept in a docker volume (kept out of the standard Docker layers) because writing to the copy-on-write filesystem doesn’t really make sense for persistent data / databases. Those should read and write directly to the backing filesystem. Generally you shouldn’t keep persistent state in images themselves. If you need to seed the database on docker run have a little entrypoint script or sidebar container that connects and does so.