I have a big static database where no data is inserted / updated.
I created a Dockerfile in the following manner which works well to create the database in the docker container. There are a bunch of insert .sql scripts in data/ which populates the database.
FROM mysql:5.7 ADD data/* /docker-entrypoint-initdb.d/ EXPOSE 3306
The only problem with this is that it takes a long time to start up, so I ran the container locally and adjusted it slightly so that the data persisted within the container, and I removed the startup scripts from the startup script directory. I then committed this container to a new docker image (
This worked, however the only problem I have is that the password for the mysql root user for this database is fixed to the password which I used when I committed the image.
My question is: Is there any way to run another startup script on top of this new image (which already has an existing database)? I need to modify the password of the root user to match an environment variable in the container (cant use
MYSQL_ROOT_PASSWORD now since the startup script no longer runs in the container spun up from the new committed image).