【发布时间】:2013-10-25 08:36:30
【问题描述】:
尽管有 Docker 的 Interactive tutorial 和 faq 我在容器退出时丢失了我的数据。
我已经安装了 Docker,如下所述:http://docs.docker.io/en/latest/installation/ubuntulinux 在 ubuntu 13.04 上没有任何问题。
但退出时会丢失所有数据。
iman@test:~$ sudo docker version
Client version: 0.6.4
Go version (client): go1.1.2
Git commit (client): 2f74b1c
Server version: 0.6.4
Git commit (server): 2f74b1c
Go version (server): go1.1.2
Last stable version: 0.6.4
iman@test:~$ sudo docker run ubuntu ping
2013/10/25 08:05:47 Unable to locate ping
iman@test:~$ sudo docker run ubuntu apt-get install ping
Reading package lists...
Building dependency tree...
The following NEW packages will be installed:
iputils-ping
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 56.1 kB of archives.
After this operation, 143 kB of additional disk space will be used.
Get:1 http://archive.ubuntu.com/ubuntu/ precise/main iputils-ping amd64 3:20101006-1ubuntu1 [56.1 kB]
debconf: delaying package configuration, since apt-utils is not installed
Fetched 56.1 kB in 0s (195 kB/s)
Selecting previously unselected package iputils-ping.
(Reading database ... 7545 files and directories currently installed.)
Unpacking iputils-ping (from .../iputils-ping_3%3a20101006-1ubuntu1_amd64.deb) ...
Setting up iputils-ping (3:20101006-1ubuntu1) ...
iman@test:~$ sudo docker run ubuntu ping
2013/10/25 08:06:11 Unable to locate ping
iman@test:~$ sudo docker run ubuntu touch /home/test
iman@test:~$ sudo docker run ubuntu ls /home/test
ls: cannot access /home/test: No such file or directory
我还使用交互式会话对其进行了测试,结果相同。我是不是忘记了什么?
编辑:对 Docker 新用户很重要
正如@mohammed-noureldin 和其他人所说,实际上这不是 容器退出。每次它只是创建一个新容器。
【问题讨论】:
-
这不能称为“容器退出”,你只是在创建一个新容器,使用退出词会混淆很多(我也因此感到困惑)。
-
@MohammedNoureldin,你是对的,退出是不正确的,但这正是你,我和其他人的想法。所以这是一个更好的词,您的编辑使问题成为答案!新的搜索者不会在这里找到!
-
在我刚开始使用 Docker 时,我认为实际上由于您的问题,我发现该地址完全是错误的。新标题已经审核通过,我不明白为什么有人坚持错误的标题,这是你的问题,你的决定。
-
我同意@MohammedNoureldin。具体标题、示例和接受的答案的组合并不能帮助未来的读者,尤其是初学者理解
Docker。我建议保留标题和原始问题,因为初学者肯定会搜索这样的内容。但是,你为什么不在你写这篇文章的时候添加一些描述你的误解的东西。这将有助于使事情变得清晰。这就是我们在 SO 的文化……不是吗? :-) -
我遇到了这个问题......每次你退出你都必须启动你的容器而不是运行它......运行一个图像 agane 创建一个新容器这将有助于 docker start
docker attach
标签: docker