我正在尝试在 Azure 上构建 docker。Dockerfile 的开头如下
FROM ubuntu:16.04
RUN apt-get update && apt-get install -y libcurl4-openssl-dev libmysqlclient-dev libssl-dev
更新命令崩溃并输出以下输出
17:48:54 Step 3 : RUN apt-get update && apt-get install -y libcurl4-openssl-dev libmysqlclient-dev libssl-dev
17:48:54 ---> Running in 5a07e406e05f
17:48:54 Ign:1 http://archive.ubuntu.com/ubuntu xenial InRelease
17:48:54 Ign:2 http://archive.ubuntu.com/ubuntu xenial-updates InRelease
17:48:54 Ign:3 http://archive.ubuntu.com/ubuntu xenial-security InRelease
17:48:54 Ign:4 http://archive.ubuntu.com/ubuntu xenial Release
17:48:54 Ign:5 http://archive.ubuntu.com/ubuntu xenial-updates Release
17:48:54 Ign:6 http://archive.ubuntu.com/ubuntu xenial-security Release
17:48:54 Ign:7 http://archive.ubuntu.com/ubuntu xenial/main Sources
17:48:54 Ign:8 http://archive.ubuntu.com/ubuntu xenial/restricted Sources
17:48:54 Ign:9 http://archive.ubuntu.com/ubuntu xenial/universe Sources
17:48:54 Ign:10 http://archive.ubuntu.com/ubuntu xenial/main amd64 Packages
17:48:54 Ign:11 http://archive.ubuntu.com/ubuntu xenial/main all Packages
17:48:54 Ign:12 http://archive.ubuntu.com/ubuntu xenial/restricted amd64 Packages
17:48:54 Ign:13 http://archive.ubuntu.com/ubuntu xenial/restricted all Packages
17:48:54 Ign:14 http://archive.ubuntu.com/ubuntu xenial/universe amd64 Packages
17:48:54 Ign:15 http://archive.ubuntu.com/ubuntu xenial/universe all Packages
17:48:54 Ign:16 http://archive.ubuntu.com/ubuntu xenial-updates/main Sources
17:48:54 Ign:17 http://archive.ubuntu.com/ubuntu xenial-updates/restricted Sources
17:48:54 Ign:18 http://archive.ubuntu.com/ubuntu xenial-updates/universe Sources
17:48:54 Ign:19 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 Packages
17:48:54 Ign:20 http://archive.ubuntu.com/ubuntu xenial-updates/main all Packages
17:48:54 Ign:21 http://archive.ubuntu.com/ubuntu xenial-updates/restricted amd64 Packages
17:48:54 Ign:22 http://archive.ubuntu.com/ubuntu xenial-updates/restricted all Packages
17:48:55 Ign:23 http://archive.ubuntu.com/ubuntu xenial-updates/universe amd64 Packages
17:48:55 Ign:24 http://archive.ubuntu.com/ubuntu xenial-updates/universe all Packages
17:48:55 Ign:25 http://archive.ubuntu.com/ubuntu xenial-security/main Sources
17:48:55 Ign:26 http://archive.ubuntu.com/ubuntu xenial-security/restricted Sources
17:48:55 Ign:27 http://archive.ubuntu.com/ubuntu xenial-security/universe Sources
17:48:55 Ign:28 http://archive.ubuntu.com/ubuntu xenial-security/main amd64 Packages
17:48:55 Ign:29 http://archive.ubuntu.com/ubuntu xenial-security/main all Packages
17:48:55 Ign:30 http://archive.ubuntu.com/ubuntu xenial-security/restricted amd64 Packages
17:48:55 Ign:31 http://archive.ubuntu.com/ubuntu xenial-security/restricted all Packages
17:48:55 Ign:32 http://archive.ubuntu.com/ubuntu xenial-security/universe amd64 Packages
17:48:55 Ign:33 http://archive.ubuntu.com/ubuntu xenial-security/universe all Packages
17:48:55 Ign:7 http://archive.ubuntu.com/ubuntu xenial/main Sources
17:48:55 Ign:8 http://archive.ubuntu.com/ubuntu xenial/restricted Sources
17:48:55 Ign:9 http://archive.ubuntu.com/ubuntu xenial/universe Sources
17:48:55 Ign:10 http://archive.ubuntu.com/ubuntu xenial/main amd64 Packages
17:48:55 Ign:11 http://archive.ubuntu.com/ubuntu xenial/main all Packages
17:48:55 Ign:12 http://archive.ubuntu.com/ubuntu xenial/restricted amd64 Packages
17:48:55 Ign:13 http://archive.ubuntu.com/ubuntu xenial/restricted all Packages
17:48:55 Ign:14 http://archive.ubuntu.com/ubuntu xenial/universe amd64 Packages
17:48:55 Ign:15 http://archive.ubuntu.com/ubuntu xenial/universe all Packages
17:48:55 Ign:16 http://archive.ubuntu.com/ubuntu xenial-updates/main Sources
17:48:55 Ign:17 http://archive.ubuntu.com/ubuntu xenial-updates/restricted Sources
17:48:55 Ign:18 http://archive.ubuntu.com/ubuntu xenial-updates/universe Sources
17:48:55 Ign:19 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 Packages
17:48:55 Ign:20 http://archive.ubuntu.com/ubuntu xenial-updates/main all Packages
17:48:55 Ign:21 http://archive.ubuntu.com/ubuntu xenial-updates/restricted amd64 Packages
17:48:55 Ign:22 http://archive.ubuntu.com/ubuntu xenial-updates/restricted all Packages
17:48:55 Ign:23 http://archive.ubuntu.com/ubuntu xenial-updates/universe amd64 Packages
17:48:55 Ign:24 http://archive.ubuntu.com/ubuntu xenial-updates/universe all Packages
17:48:55 Ign:25 http://archive.ubuntu.com/ubuntu xenial-security/main Sources
17:48:55 Ign:26 http://archive.ubuntu.com/ubuntu xenial-security/restricted Sources
17:48:55 Ign:27 http://archive.ubuntu.com/ubuntu xenial-security/universe Sources
17:48:55 Ign:28 http://archive.ubuntu.com/ubuntu xenial-security/main amd64 Packages
17:48:55 Ign:29 http://archive.ubuntu.com/ubuntu xenial-security/main all Packages
17:48:55 Ign:30 http://archive.ubuntu.com/ubuntu xenial-security/restricted amd64 Packages
17:48:55 Ign:31 http://archive.ubuntu.com/ubuntu xenial-security/restricted all Packages
17:48:55 Ign:32 http://archive.ubuntu.com/ubuntu xenial-security/universe amd64 Packages
17:48:55 Ign:33 http://archive.ubuntu.com/ubuntu xenial-security/universe all Packages
17:48:55 Ign:7 http://archive.ubuntu.com/ubuntu xenial/main Sources
17:48:55 Ign:8 http://archive.ubuntu.com/ubuntu xenial/restricted Sources
17:48:55 Ign:9 http://archive.ubuntu.com/ubuntu xenial/universe Sources
17:48:55 Ign:10 http://archive.ubuntu.com/ubuntu xenial/main amd64 Packages
17:48:55 Ign:11 http://archive.ubuntu.com/ubuntu xenial/main all Packages
17:48:55 Ign:12 http://archive.ubuntu.com/ubuntu xenial/restricted amd64 Packages
17:48:55 Ign:13 http://archive.ubuntu.com/ubuntu xenial/restricted all Packages
17:48:55 Ign:14 http://archive.ubuntu.com/ubuntu xenial/universe amd64 Packages
17:48:55 Ign:15 http://archive.ubuntu.com/ubuntu xenial/universe all Packages
17:48:55 Ign:16 http://archive.ubuntu.com/ubuntu xenial-updates/main Sources
17:48:55 Ign:17 http://archive.ubuntu.com/ubuntu xenial-updates/restricted Sources
17:48:55 Ign:18 http://archive.ubuntu.com/ubuntu xenial-updates/universe Sources
17:48:55 Ign:19 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 Packages
17:48:55 Ign:20 http://archive.ubuntu.com/ubuntu xenial-updates/main all Packages
17:48:55 Ign:21 http://archive.ubuntu.com/ubuntu xenial-updates/restricted amd64 Packages
17:48:55 Ign:22 http://archive.ubuntu.com/ubuntu xenial-updates/restricted all Packages
17:48:55 Ign:23 http://archive.ubuntu.com/ubuntu xenial-updates/universe amd64 Packages
17:48:55 Ign:24 http://archive.ubuntu.com/ubuntu xenial-updates/universe all Packages
17:48:55 Ign:25 http://archive.ubuntu.com/ubuntu xenial-security/main Sources
17:48:55 Ign:26 http://archive.ubuntu.com/ubuntu xenial-security/restricted Sources
17:48:55 Ign:27 http://archive.ubuntu.com/ubuntu xenial-security/universe Sources
17:48:55 Ign:28 http://archive.ubuntu.com/ubuntu xenial-security/main amd64 Packages
17:48:55 Ign:29 http://archive.ubuntu.com/ubuntu xenial-security/main all Packages
17:48:55 Ign:30 http://archive.ubuntu.com/ubuntu xenial-security/restricted amd64 Packages
17:48:55 Ign:31 http://archive.ubuntu.com/ubuntu xenial-security/restricted all Packages
17:48:55 Ign:32 http://archive.ubuntu.com/ubuntu xenial-security/universe amd64 Packages
17:48:55 Ign:33 http://archive.ubuntu.com/ubuntu xenial-security/universe all Packages
17:48:55 Ign:7 http://archive.ubuntu.com/ubuntu xenial/main Sources
17:48:55 Ign:8 http://archive.ubuntu.com/ubuntu xenial/restricted Sources
17:48:55 Ign:9 http://archive.ubuntu.com/ubuntu xenial/universe Sources
17:48:55 Ign:10 http://archive.ubuntu.com/ubuntu xenial/main amd64 Packages
17:48:55 Ign:11 http://archive.ubuntu.com/ubuntu xenial/main all Packages
17:48:55 Ign:12 http://archive.ubuntu.com/ubuntu xenial/restricted amd64 Packages
17:48:55 Ign:13 http://archive.ubuntu.com/ubuntu xenial/restricted all Packages
17:48:55 Ign:14 http://archive.ubuntu.com/ubuntu xenial/universe amd64 Packages
17:48:55 Ign:15 http://archive.ubuntu.com/ubuntu xenial/universe all Packages
17:48:55 Ign:16 http://archive.ubuntu.com/ubuntu xenial-updates/main Sources
17:48:55 Ign:17 http://archive.ubuntu.com/ubuntu xenial-updates/restricted Sources
17:48:55 Ign:18 http://archive.ubuntu.com/ubuntu xenial-updates/universe Sources
17:48:55 Ign:19 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 Packages
17:48:55 Ign:20 http://archive.ubuntu.com/ubuntu xenial-updates/main all Packages
17:48:55 Ign:21 http://archive.ubuntu.com/ubuntu xenial-updates/restricted amd64 Packages
17:48:55 Ign:22 http://archive.ubuntu.com/ubuntu xenial-updates/restricted all Packages
17:48:55 Ign:23 http://archive.ubuntu.com/ubuntu xenial-updates/universe amd64 Packages
17:48:55 Ign:24 http://archive.ubuntu.com/ubuntu xenial-updates/universe all Packages
17:48:55 Ign:25 http://archive.ubuntu.com/ubuntu xenial-security/main Sources
17:48:55 Ign:26 http://archive.ubuntu.com/ubuntu xenial-security/restricted Sources
17:48:55 Ign:27 http://archive.ubuntu.com/ubuntu xenial-security/universe Sources
17:48:55 Ign:28 http://archive.ubuntu.com/ubuntu xenial-security/main amd64 Packages
17:48:55 Ign:29 http://archive.ubuntu.com/ubuntu xenial-security/main all Packages
17:48:55 Ign:30 http://archive.ubuntu.com/ubuntu xenial-security/restricted amd64 Packages
17:48:55 Ign:31 http://archive.ubuntu.com/ubuntu xenial-security/restricted all Packages
17:48:55 Ign:32 http://archive.ubuntu.com/ubuntu xenial-security/universe amd64 Packages
17:48:55 Ign:33 http://archive.ubuntu.com/ubuntu xenial-security/universe all Packages
17:48:55 Ign:7 http://archive.ubuntu.com/ubuntu xenial/main Sources
17:48:55 Ign:8 http://archive.ubuntu.com/ubuntu xenial/restricted Sources
17:48:55 Ign:9 http://archive.ubuntu.com/ubuntu xenial/universe Sources
17:48:55 Ign:10 http://archive.ubuntu.com/ubuntu xenial/main amd64 Packages
17:48:55 Ign:11 http://archive.ubuntu.com/ubuntu xenial/main all Packages
17:48:55 Ign:12 http://archive.ubuntu.com/ubuntu xenial/restricted amd64 Packages
17:48:55 Ign:13 http://archive.ubuntu.com/ubuntu xenial/restricted all Packages
17:48:55 Ign:14 http://archive.ubuntu.com/ubuntu xenial/universe amd64 Packages
17:48:55 Ign:15 http://archive.ubuntu.com/ubuntu xenial/universe all Packages
17:48:55 Ign:16 http://archive.ubuntu.com/ubuntu xenial-updates/main Sources
17:48:55 Ign:17 http://archive.ubuntu.com/ubuntu xenial-updates/restricted Sources
17:48:55 Ign:18 http://archive.ubuntu.com/ubuntu xenial-updates/universe Sources
17:48:55 Ign:19 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 Packages
17:48:55 Ign:20 http://archive.ubuntu.com/ubuntu xenial-updates/main all Packages
17:48:55 Ign:21 http://archive.ubuntu.com/ubuntu xenial-updates/restricted amd64 Packages
17:48:55 Ign:22 http://archive.ubuntu.com/ubuntu xenial-updates/restricted all Packages
17:48:55 Ign:23 http://archive.ubuntu.com/ubuntu xenial-updates/universe amd64 Packages
17:48:55 Ign:24 http://archive.ubuntu.com/ubuntu xenial-updates/universe all Packages
17:48:55 Ign:25 http://archive.ubuntu.com/ubuntu xenial-security/main Sources
17:48:55 Ign:26 http://archive.ubuntu.com/ubuntu xenial-security/restricted Sources
17:48:55 Ign:27 http://archive.ubuntu.com/ubuntu xenial-security/universe Sources
17:48:55 Ign:28 http://archive.ubuntu.com/ubuntu xenial-security/main amd64 Packages
17:48:55 Ign:29 http://archive.ubuntu.com/ubuntu xenial-security/main all Packages
17:48:55 Ign:30 http://archive.ubuntu.com/ubuntu xenial-security/restricted amd64 Packages
17:48:55 Ign:31 http://archive.ubuntu.com/ubuntu xenial-security/restricted all Packages
17:48:55 Ign:32 http://archive.ubuntu.com/ubuntu xenial-security/universe amd64 Packages
17:48:55 Ign:33 http://archive.ubuntu.com/ubuntu xenial-security/universe all Packages
17:48:55 Err:7 http://archive.ubuntu.com/ubuntu xenial/main Sources
17:48:55 403 Forbidden [IP: 91.189.88.162 80]
17:48:55 Ign:8 http://archive.ubuntu.com/ubuntu xenial/restricted Sources
17:48:55 Ign:9 http://archive.ubuntu.com/ubuntu xenial/universe Sources
17:48:55 Ign:10 http://archive.ubuntu.com/ubuntu xenial/main amd64 Packages
17:48:55 Ign:11 http://archive.ubuntu.com/ubuntu xenial/main all Packages
17:48:55 Ign:12 http://archive.ubuntu.com/ubuntu xenial/restricted amd64 Packages
17:48:55 Ign:13 http://archive.ubuntu.com/ubuntu xenial/restricted all Packages
17:48:55 Ign:14 http://archive.ubuntu.com/ubuntu xenial/universe amd64 Packages
17:48:55 Ign:15 http://archive.ubuntu.com/ubuntu xenial/universe all Packages
17:48:55 Err:16 http://archive.ubuntu.com/ubuntu xenial-updates/main Sources
17:48:55 403 Forbidden [IP: 91.189.88.162 80]
17:48:55 Ign:17 http://archive.ubuntu.com/ubuntu xenial-updates/restricted Sources
17:48:55 Ign:18 http://archive.ubuntu.com/ubuntu xenial-updates/universe Sources
17:48:55 Ign:19 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 Packages
17:48:55 Ign:20 http://archive.ubuntu.com/ubuntu xenial-updates/main all Packages
17:48:55 Ign:21 http://archive.ubuntu.com/ubuntu xenial-updates/restricted amd64 Packages
17:48:55 Ign:22 http://archive.ubuntu.com/ubuntu xenial-updates/restricted all Packages
17:48:55 Ign:23 http://archive.ubuntu.com/ubuntu xenial-updates/universe amd64 Packages
17:48:55 Ign:24 http://archive.ubuntu.com/ubuntu xenial-updates/universe all Packages
17:48:55 Err:25 http://archive.ubuntu.com/ubuntu xenial-security/main Sources
17:48:55 403 Forbidden [IP: 91.189.88.162 80]
17:48:55 Ign:26 http://archive.ubuntu.com/ubuntu xenial-security/restricted Sources
17:48:55 Ign:27 http://archive.ubuntu.com/ubuntu xenial-security/universe Sources
17:48:55 Ign:28 http://archive.ubuntu.com/ubuntu xenial-security/main amd64 Packages
17:48:55 Ign:29 http://archive.ubuntu.com/ubuntu xenial-security/main all Packages
17:48:55 Ign:30 http://archive.ubuntu.com/ubuntu xenial-security/restricted amd64 Packages
17:48:55 Ign:31 http://archive.ubuntu.com/ubuntu xenial-security/restricted all Packages
17:48:55 Ign:32 http://archive.ubuntu.com/ubuntu xenial-security/universe amd64 Packages
17:48:55 Ign:33 http://archive.ubuntu.com/ubuntu xenial-security/universe all Packages
17:48:55 Reading package lists...
17:48:55 [91mW[0m[91m: The repository 'http://archive.ubuntu.com/ubuntu xenial Release' does not have a Release file.
17:48:55 [0m[91mW: The repository 'http://archive.ubuntu.com/ubuntu xenial-updates Release' does not have a Release file.[0m[91m
17:48:55 W: [0m[91mThe repository 'http://archive.ubuntu.com/ubuntu xenial-security Release' does not have a Release file.[0m[91m
17:48:55 [0m[91mE: [0m[91mFailed to fetch http://archive.ubuntu.com/ubuntu/dists/xenial/main/source/Sources 403 Forbidden [IP: 91.189.88.162 80]
17:48:55 [0m[91mE: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/xenial-updates/main/source/Sources 403 Forbidden [IP: 91.189.88.162 80]
17:48:55 [0m[91mE[0m[91m: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/xenial-security/main/source/Sources 403 Forbidden [IP: 91.189.88.162 80][0m[91m
17:48:55 E: Some index files failed to download. They have been ignored, or old ones used instead.
17:48:55 [0mThe command '/bin/sh -c apt-get update && apt-get install -y libcurl4-openssl-dev libmysqlclient-dev libssl-dev' returned a non-zero code: 100
相同的 Dockerfile 在我的笔记本电脑和其他 Azure VM 上构建良好。我尝试重新部署 VM,但没有成功。是什么导致此特定命令在此 VM 上失败,而在其他 VM 上却没有失败?Azure VM 正在运行 ubuntu 16.04(来自 Microsoft 的标准映像),它正在运行的 VM 也是如此。
编辑:创建了新的 VM,这次使用 Azure docker 映像,我遇到了同样的问题。仍在处理几个月前创建的另一台 VM。
答案1
我有确切地尝试在 Google Compute Engine 上使用 ubuntu 16.04 运行 docker 容器时遇到同样的问题。
快速解决(对于 GCE 来说):
使用 ftp 代替 httpeg
sed -i s/http/ftp/ /etc/apt/sources.list && apt-get update
我的猜测是云提供商有自己的镜像(有道理,只要想想apt-get update
在他们的 dc 中运行了多少次...拥有本地镜像可以节省大量带宽)
也许某些 http 代理没有将来自 docker 镜像的请求重定向到镜像……