尽管有 Docker 的交互式教程和常见问题解答,但当容器退出时,我会丢失我的数据。
我已经按照此处所述安装了 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 和其他人所说,实际上这不是一个容器正在退出。每次它只是创建一个新容器。