文档地址 https://docs.docker.com/engine/getstarted/step_four/
按照文档步骤来的,执行该命令时报错。
试了在 Dockerfile 中加入 apt-get clean 和 sudo rm -vf /var/lib/apt/lists/*,只能减少几条 Get 报错,不能完全解决问题。
我猜测大概是 Ubuntu 的源的问题,不知道如何改 image 的源。
Docker 的设置中已添加过了 Daocloud 的加速器。
Dockerfile 文件
FROM docker/whalesay:latest
RUN apt-get -y update && apt-get install -y fortunes
CMD /usr/games/fortune -a | cowsay
命令执行过程
$ docker build -t docker-whale .
Sending build context to Docker daemon 2.048 kB
Step 1/3 : FROM docker/whalesay:latest
---> 6b362a9f73eb
Step 2/3 : RUN apt-get -y update && apt-get install -y fortunes
---> Running in c4bed37eb3f2
Ign http://archive.ubuntu.com trusty InRelease
Get:1 http://archive.ubuntu.com trusty-updates InRelease [65.9 kB]
Get:2 http://archive.ubuntu.com trusty-security InRelease [65.9 kB]
Hit http://archive.ubuntu.com trusty Release.gpg
Get:3 http://archive.ubuntu.com trusty-updates/main Sources [1103 kB]
Hit http://archive.ubuntu.com trusty Release
Get:4 http://archive.ubuntu.com trusty-updates/universe Sources [220 kB]
Get:5 http://archive.ubuntu.com trusty-updates/main amd64 Packages [1197 kB]
Get:6 http://archive.ubuntu.com trusty-updates/restricted Sources [1103 kB]
Get:7 http://archive.ubuntu.com trusty-updates/restricted amd64 Packages [1197 kB]
Get:8 http://archive.ubuntu.com trusty-security/restricted Sources [1103 kB]
Get:9 http://archive.ubuntu.com trusty-security/restricted amd64 Packages [17.0 kB]
Get:10 http://archive.ubuntu.com trusty-updates/universe amd64 Packages [1197 kB]
Get:11 http://archive.ubuntu.com trusty-security/main Sources [2815 B]
Get:12 http://archive.ubuntu.com trusty-security/universe Sources [2815 B]
Get:13 http://archive.ubuntu.com trusty-security/main amd64 Packages [1197 kB]
Hit http://archive.ubuntu.com trusty/restricted Sources
Get:14 http://archive.ubuntu.com trusty-security/universe amd64 Packages [1197 kB]
Get:15 http://archive.ubuntu.com trusty/universe Sources [220 kB]
Get:16 http://archive.ubuntu.com trusty/main Sources [2815 B]
Get:17 http://archive.ubuntu.com trusty/main amd64 Packages [14.8 kB]
Hit http://archive.ubuntu.com trusty/restricted amd64 Packages
Get:18 http://archive.ubuntu.com trusty/universe amd64 Packages [17.0 kB]
Fetched 9920 kB in 17s (580 kB/s)
W: Size of file /var/lib/apt/lists/archive.ubuntu.com_ubuntu_dists_trusty_main_source_Sources.gz is not what the server reported 2815 1334581
W: Size of file /var/lib/apt/lists/archive.ubuntu.com_ubuntu_dists_trusty_universe_source_Sources.gz is not what the server reported 220105 7925687
W: Size of file /var/lib/apt/lists/archive.ubuntu.com_ubuntu_dists_trusty_main_binary-amd64_Packages.gz is not what the server reported 14793 1743009
W: Size of file /var/lib/apt/lists/archive.ubuntu.com_ubuntu_dists_trusty_universe_binary-amd64_Packages.gz is not what the server reported 17048 7588885
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/trusty-updates/main/source/Sources Hash Sum mismatch
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/trusty-updates/restricted/source/Sources Hash Sum mismatch
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/trusty-updates/universe/source/Sources Hash Sum mismatch
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/trusty-updates/main/binary-amd64/Packages Hash Sum mismatch
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/trusty-updates/restricted/binary-amd64/Packages Hash Sum mismatch
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/trusty-updates/universe/binary-amd64/Packages Hash Sum mismatch
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/trusty-security/main/source/Sources Hash Sum mismatch
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/trusty-security/restricted/source/Sources Hash Sum mismatch
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/trusty-security/universe/source/Sources Hash Sum mismatch
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/trusty-security/main/binary-amd64/Packages Hash Sum mismatch
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/trusty-security/universe/binary-amd64/Packages Hash Sum mismatch
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/trusty/main/source/Sources Hash Sum mismatch
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/trusty/universe/source/Sources Hash Sum mismatch
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/trusty/main/binary-amd64/Packages Hash Sum mismatch
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/trusty/universe/binary-amd64/Packages Hash Sum mismatch
E: Some index files failed to download. They have been ignored, or old ones used instead.
The command '/bin/sh -c apt-get -y update && apt-get install -y fortunes' returned a non-zero code: 100
这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。
V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。
V2EX is a community of developers, designers and creative people.