Under docker for windows of windows container mysql persistence

mysql the windows container persistent pattern

1, that it is really a headache, windows container mode online are finding out something fundamental, Here are some ways their own way.

About mount a local directory mapped to the container, simply does not help, the container has been unexpectedly quit, no way, can only think of other way, to find ways on Dockerfile.

FROM steeltoeoss/mysql:latest
MAINTAINER xiyue
WORKDIR C:/MySQL/bin
COPY ./mysql_init.txt C:/ 
ENV Path=C:/Windows/system32;C:/Windows;C:/Windows/System32/Wbem;C:/Windows/System32/WindowsPowerShell/v1.0/;C:/Users/ContainerAdministrator/AppData/Local/Microsoft/WindowsApps;C:/MySQL/bin;
ENV MYSQL=C:/MySQL
VOLUME C:/MySQLDATA
ENTRYPOINT mysqld --init-file=C:/mysql_init.txt --console

Keep up this image of a similar article on will reset the root password manually, this time I wrote these things Dockerfile in the provincial part of the story.

VOLUME containers is to mount the volume, this volume corresponds to the local container to the docker directory, which directory corresponding to the specific command See below

docker inspect mysqlContainer

2, after the start of the container, the container will have a data volume, mysql databases are stored in the C: / MySQL / down data, to persistent data, put the stuff in this catalog copy to the data volume, or else directly in mysql settings, so that the database is stored directly in the data scrolls.
To put it plainly, is the need to manually migrate a copy of the write command, this command will not copy directly to use

xcopy C:\MySQL\data C:\MySQLDATA
Published 45 original articles · won praise 1 · views 1074

Guess you like

Origin blog.csdn.net/lqq404270201/article/details/103783524
Recommended