docker build镜像时容器联网失败的故障 已解决

在使用docker bulid 建立自己的镜像文件时,出现下面的错误提示

Ign:1 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 perl-modules-5.26 all 5.26.1-6ubuntu0.3
Err:2 http://archive.ubuntu.com/ubuntu bionic/main amd64 libgdbm5 amd64 1.14.1-6
  Temporary failure resolving 'archive.ubuntu.com'
Err:1 http://security.ubuntu.com/ubuntu bionic-updates/main amd64 perl-modules-5.26 all 5.26.1-6ubuntu0.3
  Temporary failure resolving 'archive.ubuntu.com'
Err:3 http://archive.ubuntu.com/ubuntu bionic/main amd64 libgdbm-compat4 amd64 1.14.1-6
  Temporary failure resolving 'archive.ubuntu.com'
Ign:4 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libperl5.26 amd64 5.26.1-6ubuntu0.3
Err:4 http://security.ubuntu.com/ubuntu bionic-updates/main amd64 libperl5.26 amd64 5.26.1-6ubuntu0.3
  Temporary failure resolving 'archive.ubuntu.com'
Ign:5 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 perl amd64 5.26.1-6ubuntu0.3
Err:5 http://security.ubuntu.com/ubuntu bionic-updates/main amd64 perl amd64 5.26.1-6ubuntu0.3
  Temporary failure resolving 'archive.ubuntu.com'
Err:6 http://archive.ubuntu.com/ubuntu bionic/main amd64 libapr1 amd64 1.6.3-2
  Temporary failure resolving 'archive.ubuntu.com'
Err:7 http://archive.ubuntu.com/ubuntu bionic/main amd64 libaprutil1 amd64 1.6.1-2
  Temporary failure resolving 'archive.ubuntu.com'
Err:8 http://archive.ubuntu.com/ubuntu bionic/main amd64 libaprutil1-dbd-sqlite3 amd64 1.6.1-2
  Temporary failure resolving 'archive.ubuntu.com'
Err:9 http://archive.ubuntu.com/ubuntu bionic/main amd64 libroken18-heimdal amd64 7.5.0+dfsg-1
  Temporary failure resolving 'archive.ubuntu.com'
Err:10 http://archive.ubuntu.com/ubuntu bionic/main amd64 libasn1-8-heimdal amd64 7.5.0+dfsg-1
  Temporary failure resolving 'archive.ubuntu.com'
Err:11 http://archive.ubuntu.com/ubuntu bionic/main amd64 libheimbase1-heimdal amd64 7.5.0+dfsg-1
  Temporary failure resolving 'archive.ubuntu.com'
Err:12 http://archive.ubuntu.com/ubuntu bionic/main amd64 libhcrypto4-heimdal amd64 7.5.0+dfsg-1
  Temporary failure resolving 'archive.ubuntu.com'
Err:13 http://archive.ubuntu.com/ubuntu bionic/main amd64 libwind0-heimdal amd64 7.5.0+dfsg-1
  Temporary failure resolving 'archive.ubuntu.com'
Err:14 http://archive.ubuntu.com/ubuntu bionic/main amd64 libhx509-5-heimdal amd64 7.5.0+dfsg-1
  Temporary failure resolving 'archive.ubuntu.com'
Err:15 http://archive.ubuntu.com/ubuntu bionic/main amd64 libkrb5-26-heimdal amd64 7.5.0+dfsg-1
  Temporary failure resolving 'archive.ubuntu.com'
Err:16 http://archive.ubuntu.com/ubuntu bionic/main amd64 libheimntlm0-heimdal amd64 7.5.0+dfsg-1
  Temporary failure resolving 'archive.ubuntu.com'
Err:17 http://archive.ubuntu.com/ubuntu bionic/main amd64 libgssapi3-heimdal amd64 7.5.0+dfsg-1
  Temporary failure resolving 'archive.ubuntu.com'
Ign:18 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libsasl2-modules-db amd64 2.1.27~101-g0780600+dfsg-3ubuntu2.1
Err:18 http://security.ubuntu.com/ubuntu bionic-updates/main amd64 libsasl2-modules-db amd64 2.1.27~101-g0780600+dfsg-3ubuntu2.1
  Temporary failure resolving 'archive.ubuntu.com'
Ign:19 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libsasl2-2 amd64 2.1.27~101-g0780600+dfsg-3ubuntu2.1
Err:19 http://security.ubuntu.com/ubuntu bionic-updates/main amd64 libsasl2-2 amd64 2.1.27~101-g0780600+dfsg-3ubuntu2.1
  Temporary failure resolving 'archive.ubuntu.com'
Err:20 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libldap-common all 2.4.45+dfsg-1ubuntu1.4
  Temporary failure resolving 'archive.ubuntu.com'
Err:21 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libldap-2.4-2 amd64 2.4.45+dfsg-1ubuntu1.4
  Temporary failure resolving 'archive.ubuntu.com'
Err:22 http://archive.ubuntu.com/ubuntu bionic/main amd64 libaprutil1-ldap amd64 1.6.1-2
  Temporary failure resolving 'archive.ubuntu.com'
Err:23 http://archive.ubuntu.com/ubuntu bionic/main amd64 liblua5.2-0 amd64 5.2.4-1.1build1
  Temporary failure resolving 'archive.ubuntu.com'
Err:24 http://archive.ubuntu.com/ubuntu bionic/main amd64 libnghttp2-14 amd64 1.30.0-1ubuntu1
  Temporary failure resolving 'archive.ubuntu.com'
Ign:25 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 apache2-bin amd64 2.4.29-1ubuntu4.13
Err:25 http://security.ubuntu.com/ubuntu bionic-updates/main amd64 apache2-bin amd64 2.4.29-1ubuntu4.13
  Temporary failure resolving 'archive.ubuntu.com'
Ign:26 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 apache2-utils amd64 2.4.29-1ubuntu4.13
Err:26 http://security.ubuntu.com/ubuntu bionic-updates/main amd64 apache2-utils amd64 2.4.29-1ubuntu4.13
  Temporary failure resolving 'archive.ubuntu.com'
Ign:27 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 apache2-data all 2.4.29-1ubuntu4.13
Err:27 http://security.ubuntu.com/ubuntu bionic-updates/main amd64 apache2-data all 2.4.29-1ubuntu4.13
  Temporary failure resolving 'archive.ubuntu.com'
Ign:28 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 apache2 amd64 2.4.29-1ubuntu4.13
Err:28 http://security.ubuntu.com/ubuntu bionic-updates/main amd64 apache2 amd64 2.4.29-1ubuntu4.13
  Temporary failure resolving 'archive.ubuntu.com'
Err:29 http://archive.ubuntu.com/ubuntu bionic/main amd64 netbase all 5.4
  Temporary failure resolving 'archive.ubuntu.com'
Ign:30 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libsasl2-modules amd64 2.1.27~101-g0780600+dfsg-3ubuntu2.1
Err:30 http://security.ubuntu.com/ubuntu bionic-updates/main amd64 libsasl2-modules amd64 2.1.27~101-g0780600+dfsg-3ubuntu2.1
  Temporary failure resolving 'archive.ubuntu.com'
Err:31 http://archive.ubuntu.com/ubuntu bionic/main amd64 ssl-cert all 1.0.39
  Temporary failure resolving 'archive.ubuntu.com'
E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/p/perl/perl-modules-5.26_5.26.1-6ubuntu0.3_all.deb  Temporary failure resolving 'archive.ubuntu.com'
E: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/g/gdbm/libgdbm5_1.14.1-6_amd64.deb  Temporary failure resolving 'archive.ubuntu.com'
E: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/g/gdbm/libgdbm-compat4_1.14.1-6_amd64.deb  Temporary failure resolving 'archive.ubuntu.com'
E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/p/perl/libperl5.26_5.26.1-6ubuntu0.3_amd64.deb  Temporary failure resolving 'archive.ubuntu.com'
E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/p/perl/perl_5.26.1-6ubuntu0.3_amd64.deb  Temporary failure resolving 'archive.ubuntu.com'
E: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/a/apr/libapr1_1.6.3-2_amd64.deb  Temporary failure resolving 'archive.ubuntu.com'
E: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/a/apr-util/libaprutil1_1.6.1-2_amd64.deb  Temporary failure resolving 'archive.ubuntu.com'
E: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/a/apr-util/libaprutil1-dbd-sqlite3_1.6.1-2_amd64.deb  Temporary failure resolving 'archive.ubuntu.com'
E: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/h/heimdal/libroken18-heimdal_7.5.0+dfsg-1_amd64.deb  Temporary failure resolving 'archive.ubuntu.com'
E: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/h/heimdal/libasn1-8-heimdal_7.5.0+dfsg-1_amd64.deb  Temporary failure resolving 'archive.ubuntu.com'
E: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/h/heimdal/libheimbase1-heimdal_7.5.0+dfsg-1_amd64.deb  Temporary failure resolving 'archive.ubuntu.com'
E: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/h/heimdal/libhcrypto4-heimdal_7.5.0+dfsg-1_amd64.deb  Temporary failure resolving 'archive.ubuntu.com'
E: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/h/heimdal/libwind0-heimdal_7.5.0+dfsg-1_amd64.deb  Temporary failure resolving 'archive.ubuntu.com'
E: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/h/heimdal/libhx509-5-heimdal_7.5.0+dfsg-1_amd64.deb  Temporary failure resolving 'archive.ubuntu.com'
E: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/h/heimdal/libkrb5-26-heimdal_7.5.0+dfsg-1_amd64.deb  Temporary failure resolving 'archive.ubuntu.com'
E: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/h/heimdal/libheimntlm0-heimdal_7.5.0+dfsg-1_amd64.deb  Temporary failure resolving 'archive.ubuntu.com'
E: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/h/heimdal/libgssapi3-heimdal_7.5.0+dfsg-1_amd64.deb  Temporary failure resolving 'archive.ubuntu.com'
E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/c/cyrus-sasl2/libsasl2-modules-db_2.1.27~101-g0780600+dfsg-3ubuntu2.1_amd64.deb  Temporary failure resolving 'archive.ubuntu.com'
E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/c/cyrus-sasl2/libsasl2-2_2.1.27~101-g0780600+dfsg-3ubuntu2.1_amd64.deb  Temporary failure resolving 'archive.ubuntu.com'
E: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/o/openldap/libldap-common_2.4.45+dfsg-1ubuntu1.4_all.deb  Temporary failure resolving 'archive.ubuntu.com'
E: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/o/openldap/libldap-2.4-2_2.4.45+dfsg-1ubuntu1.4_amd64.deb  Temporary failure resolving 'archive.ubuntu.com'
E: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/a/apr-util/libaprutil1-ldap_1.6.1-2_amd64.deb  Temporary failure resolving 'archive.ubuntu.com'
E: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/l/lua5.2/liblua5.2-0_5.2.4-1.1build1_amd64.deb  Temporary failure resolving 'archive.ubuntu.com'
E: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/n/nghttp2/libnghttp2-14_1.30.0-1ubuntu1_amd64.deb  Temporary failure resolving 'archive.ubuntu.com'
E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/a/apache2/apache2-bin_2.4.29-1ubuntu4.13_amd64.deb  Temporary failure resolving 'archive.ubuntu.com'
E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/a/apache2/apache2-utils_2.4.29-1ubuntu4.13_amd64.deb  Temporary failure resolving 'archive.ubuntu.com'
E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/a/apache2/apache2-data_2.4.29-1ubuntu4.13_all.deb  Temporary failure resolving 'archive.ubuntu.com'
E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/a/apache2/apache2_2.4.29-1ubuntu4.13_amd64.deb  Temporary failure resolving 'archive.ubuntu.com'
E: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/n/netbase/netbase_5.4_all.deb  Temporary failure resolving 'archive.ubuntu.com'
E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/c/cyrus-sasl2/libsasl2-modules_2.1.27~101-g0780600+dfsg-3ubuntu2.1_amd64.deb  Temporary failure resolving 'archive.ubuntu.com'
E: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/s/ssl-cert/ssl-cert_1.0.39_all.deb  Temporary failure resolving 'archive.ubuntu.com'
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?

根据故障现象判断为容器连接互联网出现故障。

解决方法:启动docker服务时指定容器使用的dns地址

$ sudo dockerd --dns 8.8.8.8

 

posted @ 2020-04-16 10:13  老汉学IT  阅读(3658)  评论(0编辑  收藏  举报