MySQL databases are gone when the docker container is shutdown

痞子三分冷 提交于 2019-12-13 21:27:41

问题


I am new to docker world. I want to install some of the software packages into docker image. So I have taken Ubuntu:14.04 docker image and installed MySQL server there. Then did some works with it. Once I exit from docker image and commit it. But once I start docker container, databases which was created were gone. What would be the reason for this?


回答1:


If you start your mysql database with docker run ..., it creates each time a new and fresh container with it. You can find your old one in the list of containers with docker ps -a and you have to start your old container (docker start <container>) if you want the last state. Otherwise you have a fresh database derived from your image.



来源:https://stackoverflow.com/questions/39289394/mysql-databases-are-gone-when-the-docker-container-is-shutdown

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!