docker无法连接到archive.ubuntu.com:http:[IP:209.6.3.210 80]

时间:2014-12-12 18:11:57

标签: ubuntu docker

我在构建Dockerfile时遇到问题(在OS X上),多个库出现上述错误。我已经尝试添加谷歌DNS服务器和以下sources.list解决方法,但我在网上找到的任何内容都无法解决我的问题。

:sources.list“fix”

  RUN echo "deb http://archive.ubuntu.com/ubuntu/ $(lsb_release -sc) main universe Trusty-updates" >> /etc/apt/sources.list

:dockerfile的一部分

  FROM ubuntu:14.10
  RUN echo exit 101 > /usr/sbin/policy-rc.d && chmod +x /usr/sbin/policy-rc.d

  RUN apt-get install -y  --fix-missing software-properties-common 

  RUN apt-get update

:构建

的输出
  Step 15 : RUN apt-get install -y  --fix-missing software-properties-common
   ---> Running in 6067adba2748
  Reading package lists...
  Building dependency tree...
  Reading state information...
  The following extra packages will be installed:
    ca-certificates gir1.2-glib-2.0 iso-codes krb5-locales libasn1-8-heimdal
     libcurl3-gnutls libdbus-glib-1-2 libgcrypt20 libgirepository-1.0-1
    libglib2.0-0 libglib2.0-data libgssapi-krb5-2 libgssapi3-heimdal
    libhcrypto4-heimdal libheimbase1-heimdal libheimntlm0-heimdal
    libhx509-5-heimdal libidn11 libk5crypto3 libkeyutils1 libkrb5-26-heimdal
    libkrb5-3 libkrb5support0 libldap-2.4-2 libroken18-heimdal librtmp1
    libsasl2-2 libsasl2-modules libsasl2-modules-db libwind0-heimdal libxml2
    openssl python-apt-common python3-apt python3-dbus python3-gi python3-pycurl
    python3-software-properties sgml-base shared-mime-info unattended-upgrades
    xdg-user-dirs xml-core xz-utils
  Suggested packages:
    isoquery rng-tools krb5-doc krb5-user libsasl2-modules-otp
    libsasl2-modules-ldap libsasl2-modules-sql libsasl2-modules-gssapi-mit
    libsasl2-modules-gssapi-heimdal python3-apt-dbg python-apt-doc
    python-dbus-doc python3-dbus-dbg libcurl4-gnutls-dev python-pycurl-doc
    python3-pycurl-dbg sgml-base-doc bsd-mailx mail-transport-agent debhelper
  The following NEW packages will be installed:
   ca-certificates gir1.2-glib-2.0 iso-codes krb5-locales libasn1-8-heimdal
   libcurl3-gnutls libdbus-glib-1-2 libgcrypt20 libgirepository-1.0-1
    libglib2.0-0 libglib2.0-data libgssapi-krb5-2 libgssapi3-heimdal
   libhcrypto4-heimdal libheimbase1-heimdal libheimntlm0-heimdal
   libhx509-5-heimdal libidn11 libk5crypto3 libkeyutils1 libkrb5-26-heimdal
   libkrb5-3 libkrb5support0 libldap-2.4-2 libroken18-heimdal librtmp1
   libsasl2-2 libsasl2-modules libsasl2-modules-db libwind0-heimdal libxml2
   openssl python-apt-common python3-apt python3-dbus python3-gi python3-pycurl
   python3-software-properties sgml-base shared-mime-info
   software-properties-common unattended-upgrades xdg-user-dirs xml-core
   xz-utils
   0 upgraded, 45 newly installed, 0 to remove and 0 not upgraded.
   Need to get 8227 kB of archives.
   After this operation, 45.4 MB of additional disk space will be used.
   Err http://archive.ubuntu.com/ubuntu/ utopic/main libroken18-heimdal amd64 1.6~rc2+dfsg-8
    Unable to connect to archive.ubuntu.com:http: [IP: 209.6.3.210 80]
    Err http://archive.ubuntu.com/ubuntu/ utopic/main libasn1-8-heimdal amd64 1.6~rc2+dfsg-8
    Unable to connect to archive.ubuntu.com:http: [IP: 209.6.3.210 80]
   Err http://archive.ubuntu.com/ubuntu/ utopic/main libkrb5support0 amd64 1.12.1+dfsg-10
   Unable to connect to archive.ubuntu.com:http: [IP: 209.6.3.210 80]

   ...

   Unable to correct missing packages. 
    E: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/h/heimdal/libroken18- heimdal_1.6~rc2+dfsg-8_amd64.deb  Unable to connect to archive.ubuntu.com:http: [IP: 209.6.3.210 80]

    E: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/h/heimdal/libasn1-8- heimdal_1.6~rc2+dfsg-8_amd64.deb  Unable to connect to archive.ubuntu.com:http: [IP: 209.6.3.210 80]

    Unable to connect to archive.ubuntu.com:http: [IP: 209.6.3.210 80]

    ...


    E: Aborting install.
       2014/12/12 10:24:32 The command [/bin/sh -c apt-get install -y  --fix-missing software-   properties-common] returned a non-zero code: 100

1 个答案:

答案 0 :(得分:2)

为什么在apt-get update后运行apt-get install?我认为你遇到的问题是你的存储库缓存有一个死机,你无法连接到它。这个Dockerfile现在正在运行:

  FROM ubuntu:14.10
  RUN echo exit 101 > /usr/sbin/policy-rc.d && chmod +x /usr/sbin/policy-rc.d

  RUN apt-get update

  RUN apt-get install -y  --fix-missing software-properties-common