当docker容器关闭时,MySQL数据库已经消失 [英] MySQL databases are gone when the docker container is shutdown

查看:1862
本文介绍了当docker容器关闭时,MySQL数据库已经消失的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是码头世界的新人。我想将一些软件包安装到docker图像中。所以我采取了Ubuntu:14.04码头图像,并在那里安装了MySQL服务器。然后做了一些工作。一旦我退出了停泊港的形象并提交了它。但是一旦我启动了docker容器,创建的数据库就已经没了。这是什么原因?

解决方案

如果您使用 docker run ..启动您的mysql数据库,它每次创建一个新的和新鲜的容器。您可以在 docker ps -a 的容器列表中找到旧的容器,您必须启动旧容器( docker start< container> )如果你想要最后一个状态。否则,您有一个从您的图像派生的新数据库。


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?

解决方案

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.

这篇关于当docker容器关闭时,MySQL数据库已经消失的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆