简体   繁体   English

如何在 docker 中保存 docker 图像和 DB?

[英]How to save docker image and DB in docker?

I am a new one in dockers so it is probably dumb question, but I couldnt figure it out.我是码头工人的新人,所以这可能是个愚蠢的问题,但我想不通。

I am using Docker Toolbox (windows 10 home) to learn dockers.我正在使用 Docker Toolbox (windows 10 home) 来学习 docker。 I build docker on mysql image, created DB, conneted to DB by python.我在 mysql 映像上构建 docker,创建 DB,通过 python 连接到 DB。 Everything works fine.一切正常。

But every time I turn off my computer, I have to pull images again, run docker etc.但是每次我关闭我的电脑,我都必须再次拉取图像,运行 docker 等。

What is a good practice to save progress on dockers and not to lose any data and waste time:D?什么是保存 docker 进度而不丢失任何数据和浪费时间的好习惯:D?

I don't think the image will be lost,but the container will exit.我不认为图像会丢失,但容器会退出。 After restarting, you can find your original container using:重新启动后,您可以使用以下命令找到原始容器:

docker ps -a

and then start it:然后启动它:

docker start YourContainerName

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM