【问题标题】:docker tutorial how to install packagedocker教程如何安装包
【发布时间】:2015-09-17 05:46:11
【问题描述】:

我只是在关注 docker 的getting started,我有点迷路了。
我在我的文档中创建了一个 mydockerbuild 文件夹,并使用此代码创建了一个 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 0 : FROM docker/whalesay:latest
 ---> fb434121fc77
Step 1 : RUN apt-get -y update && apt-get install -y fortunes
 ---> Running in dafe01cfcd2b
Err http://archive.ubuntu.com trusty InRelease

Err http://archive.ubuntu.com trusty-updates InRelease

Err http://archive.ubuntu.com trusty-security InRelease

Err http://archive.ubuntu.com trusty Release.gpg
  Could not resolve 'archive.ubuntu.com'
Err http://archive.ubuntu.com trusty-updates Release.gpg
  Could not resolve 'archive.ubuntu.com'
Err http://archive.ubuntu.com trusty-security Release.gpg
  Could not resolve 'archive.ubuntu.com'
Reading package lists...
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/trusty/InRelease  

W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/trusty-updates/InRelease  

W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/trusty-security/InRelease  

W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/trusty/Release.gpg  Could not resolve 'archive.ubuntu.com'

W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/trusty-updates/Release.gpg  Could not resolve 'archive.ubuntu.com'

W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/trusty-security/Release.gpg  Could not resolve 'archive.ubuntu.com'

W: Some index files failed to download. They have been ignored, or old ones used instead.
Reading package lists...
Building dependency tree...
Reading state information...
The following extra packages will be installed:
  fortune-mod fortunes-min librecode0
Suggested packages:
  x11-utils bsdmainutils
The following NEW packages will be installed:
  fortune-mod fortunes fortunes-min librecode0
0 upgraded, 4 newly installed, 0 to remove and 3 not upgraded.
Need to get 1961 kB of archives.
After this operation, 4817 kB of additional disk space will be used.
Err http://archive.ubuntu.com/ubuntu/ trusty/main librecode0 amd64 3.6-21
  Could not resolve 'archive.ubuntu.com'
Err http://archive.ubuntu.com/ubuntu/ trusty/universe fortune-mod amd64 1:1.99.1-7
  Could not resolve 'archive.ubuntu.com'
Err http://archive.ubuntu.com/ubuntu/ trusty/universe fortunes-min all 1:1.99.1-7
  Could not resolve 'archive.ubuntu.com'
Err http://archive.ubuntu.com/ubuntu/ trusty/universe fortunes all 1:1.99.1-7
  Could not resolve 'archive.ubuntu.com'
E: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/r/recode/librecode0_3.6-21_amd64.deb  Could not resolve 'archive.ubuntu.com'

E: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/universe/f/fortune-mod/fortune-mod_1.99.1-7_amd64.deb  Could not resolve 'archive.ubuntu.com'

E: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/universe/f/fortune-mod/fortunes-min_1.99.1-7_all.deb  Could not resolve 'archive.ubuntu.com'

E: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/universe/f/fortune-mod/fortunes_1.99.1-7_all.deb  Could not resolve 'archive.ubuntu.com'

E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?
The command '/bin/sh -c apt-get -y update && apt-get install -y fortunes' returned a non-zero code: 100

我认为错误来自 apt-get update 但当我在计算机上执行此操作时没有问题。
我正在运行 ubuntu 14.04

【问题讨论】:

    标签: docker ubuntu-14.04 updates apt-get dockerfile


    【解决方案1】:

    您可以尝试根据错误消息调整更新命令:

    无法获取一些档案,也许运行 apt-get update 或尝试使用 --fix-missing?

    【讨论】:

    • 我的 dockerfil 中出现了 --fix-missing,现在我的 apt-get 更新没有错误,但安装仍然无法正常工作
    • 这是一个不同的问题。
    • 不,这是同一个问题,教程中的同样错误
    【解决方案2】:

    所以我发现了问题,错误是容器内的连接问题。

    我为不使用个人 wifi 网络的人找到了有关此问题的其他主题。

    所以我只是在手机上使用 3G 运行命令,它就可以工作了。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2018-06-02
      • 2016-09-18
      • 1970-01-01
      • 1970-01-01
      • 2015-07-04
      • 2023-03-09
      • 1970-01-01
      相关资源
      最近更新 更多