I created a mysql docker image and launched the container successfully. I have used this instance for a while and it has a lot of data in it. Now I want to change its startup parameters to add character-set-server. How can I restart this mysql instance with this parameter without loosing any data?
Asked
Active
Viewed 3,015 times
1 Answers
0
It depends, as explained in the mysql docker page how you stored your database:
- through a data volume: you would need to inspect your current container in order to get the path of that volume, and you can then move it to the path of the new volume of your new container launched by your new image. I did that with a script, but with docker 1.10, 1.11,
docker volume ls
can help too. - through a data directory on the host system mounted in your container, in which case you don't have to do anything else than mounting that same host folder in your new container.
In both instances, you need to add your custom config as explained in the mysql docker page:
The MySQL startup configuration is specified in the file
/etc/mysql/my.cnf
, and that file in turn includes any files found in the/etc/mysql/conf.d
directory that end with.cnf
.Settings in files in this directory will augment and/or override settings in
/etc/mysql/my.cnf
. If you want to use a customized MySQL configuration, you can create your alternative configuration file in a directory on the host machine and then mount that directory location as/etc/mysql/conf.d
inside the mysql container.