当容器退出时,我丢失了数据 [英] I lose my data when the container exits
问题描述
我已经按照这里所述安装了Docker: http: //docs.docker.io/en/latest/installation/ubuntulinux
在ubuntu 13.04上没有任何问题。
但是它丢失了所有数据退出时。
iman @ test:〜$ sudo docker版本
客户端版本:0.6.4
Go版本(客户端):go1.1.2
Git提交(客户端):2f74b1c
服务器版本:0.6.4
Git提交(服务器):2f74b1c
转到版本(服务器) :go1.1.2
最后稳定版本:0.6.4
iman @ test:〜$ sudo docker运行ubuntu ping
2013/10/25 08:05 :47无法找到ping
iman @ test:〜$ sudo docker运行ubuntu apt-get install ping
读取包列表...
构建依赖关系树...
将安装以下新包:
iputils-ping
0升级,1新安装,0删除,0未升级。
需要获取56.1 kB的档案。
此操作后,将使用143 kB的额外磁盘空间。
获取:1 http://archive.ubuntu.com/ubuntu/ precise / main iputils-ping amd64 3:20101006-1ubuntu1 [56.1 kB]
debconf:延迟包配置,因为apt-utils是未安装
在0s(195 kB / s)中获取56.1 kB
选择以前未选择的包iputils-ping。
(读取数据库...目前安装的7545个文件和目录)
打开iputils-ping(从... / iputils-ping_3%3a20101006-1ubuntu1_amd64.deb)...
设置up iputils-ping(3:20101006-1ubuntu1)...
iman @ test:〜$ sudo docker run ubuntu ping
2013/10/25 08:06:11无法找到ping
iman @ test:〜$ sudo docker运行ubuntu touch / home / test
iman @ test:〜$ sudo docker运行ubuntu ls / home / test
ls:无法访问/ home / test:没有这样文件或目录
我还使用相同的结果进行了交互式会话测试。我忘了一些东西吗?
您需要 commit 对容器进行的更改,然后运行它。尝试这样:
sudo docker pull ubuntu
sudo docker运行ubuntu apt-get install -y ping
然后使用以下命令获取容器ID:
sudo docker ps -l
将更改提交到容器:
sudo docker commit< container_id> iman / ping
然后运行容器:
sudo docker运行iman / ping ping www.google.com
这应该有效。
Despite Docker's Interactive tutorial and faq I lose my data when the container exits.
I have installed Docker as described here: http://docs.docker.io/en/latest/installation/ubuntulinux without any problem on ubuntu 13.04.
But it loses all data when exits.
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
I also tested it with interactive sessions with the same result. Did I forget something?
You need to commit the changes you make to the container and then run it. Try this:
sudo docker pull ubuntu
sudo docker run ubuntu apt-get install -y ping
Then get the container id using this command:
sudo docker ps -l
Commit changes to the container:
sudo docker commit <container_id> iman/ping
Then run the container:
sudo docker run iman/ping ping www.google.com
This should work.
这篇关于当容器退出时,我丢失了数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!