首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >ubuntu 14.04主机上的正式Ubuntu对接映像下载失败

ubuntu 14.04主机上的正式Ubuntu对接映像下载失败
EN

Stack Overflow用户
提问于 2015-06-23 22:52:38
回答 1查看 336关注 0票数 0

试图从Ubuntu14.04.02可信服务器上的正式ubuntu:12.04ubuntu:latest构建一个新的对接映像。

这不是DNS问题。它很好用。我不是代理背后的人。我有网络连接,但不能下载文件。总是得到404: file not found,但是url是正确的。

最后,尝试使用以下Dockerfile来证明我的观点:

代码语言:javascript
复制
FROM ubuntu
ADD 'http://ftp.unicamp.br/pub/apache/tomcat/tomcat-7/v7.0.62/bin/apache-tomcat-7.0.62.tar.gz' /
COPY wget /usr/bin/
COPY ping /bin/
COPY libidn.so.11 /usr/lib/x86_64-linux-gnu/
RUN ping -c 4 ftp.unicamp.br
RUN wget http://ftp.unicamp.br/pub/apache/tomcat/tomcat-7/v7.0.62/bin/apache-tomcat-7.0.62.tar.gz
RUN tar zxf apache-tomcat-7.0.62.tar.gz

运行命令docker build --no-cache=true -t raoni/tomcat:0.1 .

得到了以下输出:

代码语言:javascript
复制
Sending build context to Docker daemon 1.885 MB
Sending build context to Docker daemon
Step 0 : FROM ubuntu
 ---> 6d4946999d4f
Step 1 : ADD http://ftp.unicamp.br/pub/apache/tomcat/tomcat-7/v7.0.62/bin/apache-tomcat-7.0.62.tar.gz /
Downloading [==================================================>] 8.825 MB/8.825 MB
 ---> 6d13d9232ebb
Removing intermediate container a3c80c01a112
Step 2 : COPY wget /usr/bin/
 ---> ba1d72d7b503
Removing intermediate container c004c20c396e
Step 3 : COPY ping /bin/
 ---> 59fb0419c477
Removing intermediate container c2f3d5035458
Step 4 : COPY libidn.so.11 /usr/lib/x86_64-linux-gnu/
 ---> 66cf1b0c13cc
Removing intermediate container 3dccacf5c992
Step 5 : RUN ping -c 4 ftp.unicamp.br
 ---> Running in 62bbdda28ef6
PING ftp.unicamp.br (143.106.10.149) 56(84) bytes of data.
64 bytes from ftp.unicamp.br (143.106.10.149): icmp_seq=1 ttl=52 time=31.6 ms
64 bytes from ftp.unicamp.br (143.106.10.149): icmp_seq=2 ttl=52 time=31.7 ms
64 bytes from ftp.unicamp.br (143.106.10.149): icmp_seq=3 ttl=52 time=31.8 ms
64 bytes from ftp.unicamp.br (143.106.10.149): icmp_seq=4 ttl=52 time=32.0 ms

--- ftp.unicamp.br ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3003ms
rtt min/avg/max/mdev = 31.609/31.818/32.067/0.211 ms
 ---> cffab8d12f25
Removing intermediate container 62bbdda28ef6
Step 6 : RUN wget http://ftp.unicamp.br/pub/apache/tomcat/tomcat-7/v7.0.62/bin/apache-tomcat-7.0.62.tar.gz
 ---> Running in c38cf1dfb7a9
--2015-06-23 22:36:17--  http://ftp.unicamp.br/pub/apache/tomcat/tomcat-7/v7.0.62/bin/apache-tomcat-7.0.62.tar.gz
Resolving ftp.unicamp.br (ftp.unicamp.br)... 143.106.10.149
Connecting to ftp.unicamp.br (ftp.unicamp.br)|143.106.10.149|:80... connected.
HTTP request sent, awaiting response... 404 Not Found
2015-06-23 22:36:17 ERROR 404: Not Found.

The command '/bin/sh -c wget http://ftp.unicamp.br/pub/apache/tomcat/tomcat-7/v7.0.62/bin/apache-tomcat-7.0.62.tar.gz' returned a non-zero code: 8

这一产出表明:

  1. 网址是有效的和可访问的。ADD命令能够成功下载该文件。
  2. 容器中的网络连接是正常的,因为它能够平平远程主机。
  3. 容器能够解析DNS名称。

Apt更新显示了完全相同的问题,如下所示,来自命令docker run ubuntu:12.04 apt-get update的节选输出

代码语言:javascript
复制
Err http://archive.ubuntu.com precise/main Sources
  404  Not Found [IP: 91.189.91.13 80]
Err http://archive.ubuntu.com precise/restricted Sources
  404  Not Found [IP: 91.189.91.13 80]
Err http://archive.ubuntu.com precise/universe Sources
  404  Not Found [IP: 91.189.91.13 80]
Err http://archive.ubuntu.com precise/universe amd64 Packages
  404  Not Found [IP: 91.189.91.13 80]

有关信息,docker version命令输出显示:

代码语言:javascript
复制
root@vm:~/docker/test# docker version
Client version: 1.7.0
Client API version: 1.19
Go version (client): go1.4.2
Git commit (client): 0baf609
OS/Arch (client): linux/amd64
Server version: 1.7.0
Server API version: 1.19
Go version (server): go1.4.2
Git commit (server): 0baf609
OS/Arch (server): linux/amd64

提前谢谢。

编辑:

不明飞行物是静止的。谢谢托马斯。

这是一个网络IPS在边缘的古怪行为。网络支持修复,它现在工作正常。

EN

回答 1

Stack Overflow用户

发布于 2015-06-23 23:30:45

docker build执行ADD指令和执行RUN指令时,有一个重要的区别需要理解。

  • 使用ADD指令,下载将从docker主机进行,然后被推入构建上下文中。
  • 使用RUN指令,从正在运行的容器中进行下载。

这种差异可以解释为什么它与一个工作,而失败与另一个。

由于您的主机是Ubuntu,所以请确保您遵循关于ufw防火墙的Docker安装说明,该说明如下:

如果在运行Docker的同一台主机上使用UFW (简单的防火墙),则需要进行其他配置。Docker使用网桥来管理容器网络。默认情况下,UFW会丢弃所有转发流量。因此,当启用UFW时,要让Docker运行,必须适当地设置UFW的转发策略。

此外,如果您想从容器中调查问题,并且很容易地尝试命令来解决问题,我建议您在一个从同一ubuntu映像创建的容器中打开bash:

代码语言:javascript
复制
docker run -it ubuntu /bin/bash -l

然后您就可以诊断这个问题了,例如:

代码语言:javascript
复制
route
cat /etc/resolv.conf
apt-get update && apt-get -y install traceroute telnet
traceroute ftp.unicamp.br
telnet ftp.unicamp.br 80
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/31014818

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档