初始帖子
我在两个不同的CoreOS服务器上运行相同的docker镜像. (他们在Kubernetes集群中,但我认为这与当前的问题无关.)
他们都运行图像哈希01e95e0a93af.他们俩都应该卷曲.一个没有.这似乎……不可能.
好的服务器
core@ip-10-0-0-61 ~ $docker pull gcr.io/surveyadmin-001/wolfgang:commit_e78e07eb6ce5727af6ffeb4ca3e903907e3ab83a
Digest: sha256:5d8bf456ad2d08ce3cd15f05b62fddc07fda3955267ee0d3ef73ee1a96b98e68
[cut]
Status: Image is up to date for gcr.io/surveyadmin-001/wolfgang:commit_e78e07eb6ce5727af6ffeb4ca3e903907e3ab83a
core@ip-10-0-0-61 ~ $docker run -it --rm gcr.io/surveyadmin-001/wolfgang:commit_e78e07eb6ce5727af6ffeb4ca3e903907e3ab83a /bin/bash
root@d29cb8783830:/app/bundle# curl
curl: try 'curl --help' or 'curl --manual' for more information
root@d29cb8783830:/app/bundle#
糟糕的服务器
core@ip-10-0-0-212 ~ $docker pull gcr.io/surveyadmin-001/wolfgang:commit_e78e07eb6ce5727af6ffeb4ca3e903907e3ab83a
[cut]
Digest: sha256:5d8bf456ad2d08ce3cd15f05b62fddc07fda3955267ee0d3ef73ee1a96b98e68
Status: Image is up to date for gcr.io/surveyadmin-001/wolfgang:commit_e78e07eb6ce5727af6ffeb4ca3e903907e3ab83a
core@ip-10-0-0-212 ~ $docker run -it --rm gcr.io/surveyadmin-001/wolfgang:commit_e78e07eb6ce5727af6ffeb4ca3e903907e3ab83a /bin/bash
root@fe6a536393f8:/app/bundle# curl
bash: curl: command not found
root@fe6a536393f8:/app/bundle#
Full logs available on this gist.我将坏服务器从我们的生产集群中取出,但如果有人要我做任何其他研究,它仍然可以运行.
新增2015-12-04
我在两台服务器上运行了docker tag gcr.io/surveyadmin-001/wolfgang:commit_e78e07eb6ce5727af6ffeb4ca3e903907e3ab83a怪异图像,以使所有内容更具可读性.
哪个卷曲
Can you do a which curl in the first component to check where it finds its curl? And see if that file exists in the second component. – VonC
在糟糕的服务器上似乎根本不存在.
好的服务器
core@ip-10-0-0-61 ~ $docker run -it --rm weird-image /bin/bash
root@529b8f20a610:/app/bundle# which curl
/usr/bin/curl
糟糕的服务器
core@ip-10-0-0-212 ~ $docker run -it --rm weird-image /bin/bash
root@ff98c850dbaa:/app/bundle# ls /usr/bin/curl
ls: cannot access /usr/bin/curl: No such file or directory
root@ff98c850dbaa:/app/bundle#
别名码头
Any chance you have set up an alias on the bad box? Run alias docker to check – morloch
不.
好的服务器
core@ip-10-0-0-61 ~ $alias docker
-bash: alias: docker: not found
糟糕的服务器
core@ip-10-0-0-212 ~ $alias docker
-bash: alias: docker: not found
时间
更奇怪:在坏服务器上运行容器需要更长的时间.
好的服务器
core@ip-10-0-0-61 ~ $time docker run weird-image echo "Done"
Done
real 0m0.422s
user 0m0.015s
sys 0m0.015s
糟糕的服务器
core@ip-10-0-0-212 ~ $time docker run weird-image echo "Done"
Done
real 0m4.602s
user 0m0.010s
sys 0m0.010s
最佳答案 我已经看到很多情况下,磁盘上的Docker映像会随机出现损坏的部分(导致像你在这里描述的那样出现奇怪的不一致),删除和重新拉动映像会“修复”问题.
为了测试这个,你要确保你不仅要停泊rmi gcr.io/surveyadmin-001/wolfgang:commit_e78e07eb6ce5727af6ffeb4ca3e903907e3ab83a(这将最低限度地输出Untagged:gcr.io/surveyadmin-001/wolfgang:commit_e78e07eb6ce5727af6ffeb4ca3e903907e3ab83a),还要删除各个层(以及它们可能具有的任何其他标签),以便它们被迫重新拉动.