Docker 构建失败

Docker 构建失败


fly@LENOVO-XIAOXINCHAO:/mnt/e/docker-desktop-data/docker-file$ docker build -t ubuntu14.04-nvt:v1 .
[+] Building 122.4s (6/10)
 => [internal] load build definition from Dockerfile                                                                                                   0.5s
 => => transferring dockerfile: 38B                                                                                                                    0.0s
 => [internal] load .dockerignore                                                                                                                      0.7s
 => => transferring context: 2B                                                                                                                        0.0s
 => [internal] load metadata for docker.io/library/ubuntu:14.04                                                                                       34.7s
 => CACHED [1/6] FROM docker.io/library/ubuntu:14.04@sha256:d7a459ecd77ebb09525584f2c3e1bb7f6a2879d90df8a3523c1b899dfc2a226f                           0.0s
 => [internal] load build context                                                                                                                      0.7s
 => => transferring context: 244B                                                                                                                      0.1s
 => ERROR [2/6] RUN apt-get update -q && apt-get install -y -q     bash-completion     bc     bison     build-essential     cpio     curl     dos2un  86.6s
------
 > [2/6] RUN apt-get update -q && apt-get install -y -q     bash-completion     bc     bison     build-essential     cpio     curl     dos2unix     enca     flex     gawk     gcc-multilib     gettext     git-core     g++-multilib     gnupg     gperf     libc6-dev-i386     libx11-dev     lib32ncurses5-dev     lib32z1     nano     python     rsync     subversion     sudo     texinfo     tofrodos     wget     x11proto-core-dev     zip     zlib1g-dev     make     libc6     lib32stdc++6     zlib1g-dev     ncurses-term     libncursesw5-dev     g++     u-boot-tools     texinfo     texlive     gawk     upx     pngquant     libgl1-mesa-dev     mingw32     lib32bz2-1.0     mtd-utils     vim     squashfs-tools     cmake     liblz4-tool     device-tree-compiler     mingw-w64  && rm -rf /var/lib/apt/lists/*:
#5 3.049 Get:1 https://esm.ubuntu.com trusty-infra-security InRelease
#5 3.354 Get:2 https://esm.ubuntu.com trusty-infra-updates InRelease
#5 3.710 Get:3 https://esm.ubuntu.com trusty-infra-security/main amd64 Packages
#5 5.216 Get:4 https://esm.ubuntu.com trusty-infra-updates/main amd64 Packages
#5 85.97 Err http://archive.ubuntu.com trusty InRelease
#5 85.97
#5 85.97 Err http://archive.ubuntu.com trusty-updates InRelease
#5 85.97
#5 85.97 Err http://archive.ubuntu.com trusty-backports InRelease
#5 85.97
#5 85.97 Err http://security.ubuntu.com trusty-security InRelease
#5 85.97
#5 85.97 Err http://archive.ubuntu.com trusty Release.gpg
#5 85.97   Unable to connect to archive.ubuntu.com:http: [IP: 91.189.91.38 80]
#5 85.97 Err http://security.ubuntu.com trusty-security Release.gpg
#5 85.97   Unable to connect to security.ubuntu.com:http: [IP: 185.125.190.36 80]
#5 85.97 Err http://archive.ubuntu.com trusty-updates Release.gpg
#5 85.97   Unable to connect to archive.ubuntu.com:http: [IP: 91.189.91.38 80]
#5 85.97 Err http://archive.ubuntu.com trusty-backports Release.gpg
#5 85.97   Unable to connect to archive.ubuntu.com:http: [IP: 91.189.91.38 80]
#5 85.98 Fetched 680 kB in 1min 24s (8070 B/s)
#5 85.98 Reading package lists...
#5 86.13 W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/trusty/InRelease
#5 86.13
#5 86.13 W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/trusty-updates/InRelease
#5 86.13
#5 86.13 W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/trusty-backports/InRelease
#5 86.13
#5 86.13 W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/trusty-security/InRelease
#5 86.13
#5 86.13 W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/trusty/Release.gpg  Unable to connect to archive.ubuntu.com:http: [IP: 91.189.91.38 80]
#5 86.13
#5 86.13 W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/trusty-updates/Release.gpg  Unable to connect to archive.ubuntu.com:http: [IP: 91.189.91.38 80]
#5 86.13
#5 86.13 W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/trusty-backports/Release.gpg  Unable to connect to archive.ubuntu.com:http: [IP: 91.189.91.38 80]
#5 86.13
#5 86.13 W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/trusty-security/Release.gpg  Unable to connect to security.ubuntu.com:http: [IP: 185.125.190.36 80]
#5 86.13
#5 86.13 W: Some index files failed to download. They have been ignored, or old ones used instead.
#5 86.13 Reading package lists...
#5 86.28 Building dependency tree...
#5 86.30 Reading state information...
#5 86.30 Package liblz4-tool is not available, but is referred to by another package.
#5 86.30 This may mean that the package is missing, has been obsoleted, or
#5 86.30 is only available from another source
#5 86.30
#5 86.30 Package mingw-w64 is not available, but is referred to by another package.
#5 86.30 This may mean that the package is missing, has been obsoleted, or
#5 86.30 is only available from another source
#5 86.30
#5 86.31 E: Unable to locate package dos2unix
#5 86.31 E: Unable to locate package enca
#5 86.31 E: Unable to locate package upx
#5 86.31 E: Unable to locate package pngquant
#5 86.31 E: Unable to locate package mingw32
#5 86.31 E: Unable to locate package mtd-utils
#5 86.31 E: Package 'liblz4-tool' has no installation candidate
#5 86.31 E: Package 'mingw-w64' has no installation candidate
------
executor failed running [/bin/sh -c apt-get update -q && apt-get install -y -q     bash-completion     bc     bison     build-essential     cpio     curl     dos2unix     enca     flex     gawk     gcc-multilib     gettext     git-core     g++-multilib     gnupg     gperf     libc6-dev-i386     libx11-dev     lib32ncurses5-dev     lib32z1     nano     python     rsync     subversion     sudo     texinfo     tofrodos     wget     x11proto-core-dev     zip     zlib1g-dev     make     libc6     lib32stdc++6     zlib1g-dev     ncurses-term     libncursesw5-dev     g++     u-boot-tools     texinfo     texlive     gawk     upx     pngquant     libgl1-mesa-dev     mingw32     lib32bz2-1.0     mtd-utils     vim     squashfs-tools     cmake     liblz4-tool     device-tree-compiler     mingw-w64  && rm -rf /var/lib/apt/lists/*]: exit code: 100

你可以到容器里去操作。
然后commit 提交镜像。


root@ThinkPad-FLY:/mnt/c/Users/flyer# sudo apt-get update
Err:1 http://archive.ubuntu.com/ubuntu focal InRelease
  Cannot initiate the connection to archive.ubuntu.com:80 (2001:67c:1562::18). - connect (101: Network is unreachable) Cannot initiate the connection to archive.ubuntu.com:80 (2001:67c:1562::15). - connect (101: Network is unreachable) Cannot initiate the connection to archive.ubuntu.com:80 (2620:2d:4000:1::19). - connect (101: Network is unreachable) Cannot initiate the connection to archive.ubuntu.com:80 (2620:2d:4000:1::16). - connect (101: Network is unreachable) Could not connect to archive.ubuntu.com:80 (185.125.190.36), connection timed out Could not connect to archive.ubuntu.com:80 (91.189.91.38), connection timed out Could not connect to archive.ubuntu.com:80 (185.125.190.39), connection timed out Could not connect to archive.ubuntu.com:80 (91.189.91.39), connection timed out
Err:2 http://archive.ubuntu.com/ubuntu focal-updates InRelease
  Cannot initiate the connection to archive.ubuntu.com:80 (2001:67c:1562::18). - connect (101: Network is unreachable) Cannot initiate the connection to archive.ubuntu.com:80 (2001:67c:1562::15). - connect (101: Network is unreachable) Cannot initiate the connection to archive.ubuntu.com:80 (2620:2d:4000:1::19). - connect (101: Network is unreachable) Cannot initiate the connection to archive.ubuntu.com:80 (2620:2d:4000:1::16). - connect (101: Network is unreachable)
Err:3 http://archive.ubuntu.com/ubuntu focal-backports InRelease
  Cannot initiate the connection to archive.ubuntu.com:80 (2001:67c:1562::18). - connect (101: Network is unreachable) Cannot initiate the connection to archive.ubuntu.com:80 (2001:67c:1562::15). - connect (101: Network is unreachable) Cannot initiate the connection to archive.ubuntu.com:80 (2620:2d:4000:1::19). - connect (101: Network is unreachable) Cannot initiate the connection to archive.ubuntu.com:80 (2620:2d:4000:1::16). - connect (101: Network is unreachable)
Err:4 http://security.ubuntu.com/ubuntu focal-security InRelease
  Cannot initiate the connection to security.ubuntu.com:80 (2001:67c:1562::15). - connect (101: Network is unreachable) Cannot initiate the connection to security.ubuntu.com:80 (2001:67c:1562::18). - connect (101: Network is unreachable) Cannot initiate the connection to security.ubuntu.com:80 (2620:2d:4000:1::19). - connect (101: Network is unreachable) Cannot initiate the connection to security.ubuntu.com:80 (2620:2d:4000:1::16). - connect (101: Network is unreachable) Could not connect to security.ubuntu.com:80 (185.125.190.36), connection timed out Could not connect to security.ubuntu.com:80 (91.189.91.38), connection timed out Could not connect to security.ubuntu.com:80 (91.189.91.39), connection timed out Could not connect to security.ubuntu.com:80 (185.125.190.39), connection timed out
Reading package lists... Done
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/focal/InRelease  Cannot initiate the connection to archive.ubuntu.com:80 (2001:67c:1562::18). - connect (101: Network is unreachable) Cannot initiate the connection to archive.ubuntu.com:80 (2001:67c:1562::15). - connect (101: Network is unreachable) Cannot initiate the connection to archive.ubuntu.com:80 (2620:2d:4000:1::19). - connect (101: Network is unreachable) Cannot initiate the connection to archive.ubuntu.com:80 (2620:2d:4000:1::16). - connect (101: Network is unreachable) Could not connect to archive.ubuntu.com:80 (185.125.190.36), connection timed out Could not connect to archive.ubuntu.com:80 (91.189.91.38), connection timed out Could not connect to archive.ubuntu.com:80 (185.125.190.39), connection timed out Could not connect to archive.ubuntu.com:80 (91.189.91.39), connection timed out
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/focal-updates/InRelease  Cannot initiate the connection to archive.ubuntu.com:80 (2001:67c:1562::18). - connect (101: Network is unreachable) Cannot initiate the connection to archive.ubuntu.com:80 (2001:67c:1562::15). - connect (101: Network is unreachable) Cannot initiate the connection to archive.ubuntu.com:80 (2620:2d:4000:1::19). - connect (101: Network is unreachable) Cannot initiate the connection to archive.ubuntu.com:80 (2620:2d:4000:1::16). - connect (101: Network is unreachable)
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/focal-backports/InRelease  Cannot initiate the connection to archive.ubuntu.com:80 (2001:67c:1562::18). - connect (101: Network is unreachable) Cannot initiate the connection to archive.ubuntu.com:80 (2001:67c:1562::15). - connect (101: Network is unreachable) Cannot initiate the connection to archive.ubuntu.com:80 (2620:2d:4000:1::19). - connect (101: Network is unreachable) Cannot initiate the connection to archive.ubuntu.com:80 (2620:2d:4000:1::16). - connect (101: Network is unreachable)
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/focal-security/InRelease  Cannot initiate the connection to security.ubuntu.com:80 (2001:67c:1562::15). - connect (101: Network is unreachable) Cannot initiate the connection to security.ubuntu.com:80 (2001:67c:1562::18). - connect (101: Network is unreachable) Cannot initiate the connection to security.ubuntu.com:80 (2620:2d:4000:1::19). - connect (101: Network is unreachable) Cannot initiate the connection to security.ubuntu.com:80 (2620:2d:4000:1::16). - connect (101: Network is unreachable) Could not connect to security.ubuntu.com:80 (185.125.190.36), connection timed out Could not connect to security.ubuntu.com:80 (91.189.91.38), connection timed out Could not connect to security.ubuntu.com:80 (91.189.91.39), connection timed out Could not connect to security.ubuntu.com:80 (185.125.190.39), connection timed out
W: Some index files failed to download. They have been ignored, or old ones used instead.

=================================================


```bash

[+] Building 119.0s (6/10)
 => [internal] load build definition from Dockerfile                                                                                                   0.0s
 => => transferring dockerfile: 32B                                                                                                                    0.0s
 => [internal] load .dockerignore                                                                                                                      0.0s
 => => transferring context: 2B                                                                                                                        0.0s
 => [internal] load metadata for docker.io/library/ubuntu:14.04                                                                                       33.9s
 => CACHED [1/6] FROM docker.io/library/ubuntu:14.04@sha256:d7a459ecd77ebb09525584f2c3e1bb7f6a2879d90df8a3523c1b899dfc2a226f                           0.0s
 => [internal] load build context                                                                                                                      0.0s
 => => transferring context: 244B                                                                                                                      0.0s
 => ERROR [2/6] RUN apt-get update -q && apt-get install -y -q     bash-completion     bc     bison     build-essential     cpio     curl     dos2un  84.9s
------
 > [2/6] RUN apt-get update -q && apt-get install -y -q     bash-completion     bc     bison     build-essential     cpio     curl     dos2unix     enca     flex     gawk     gcc-multilib     gettext     git-core     g++-multilib     gnupg     gperf     libc6-dev-i386     libx11-dev     lib32ncurses5-dev     lib32z1     nano     python     rsync     subversion     sudo     texinfo     tofrodos     wget     x11proto-core-dev     zip     zlib1g-dev     make     libc6     lib32stdc++6     zlib1g-dev     ncurses-term     libncursesw5-dev     g++     u-boot-tools     texinfo     texlive     gawk     upx     pngquant     libgl1-mesa-dev     mingw32     lib32bz2-1.0     mtd-utils     vim     squashfs-tools     cmake     liblz4-tool     device-tree-compiler     mingw-w64  && rm -rf /var/lib/apt/lists/*:
#5 1.942 Get:1 https://esm.ubuntu.com trusty-infra-security InRelease
#5 2.315 Get:2 https://esm.ubuntu.com trusty-infra-updates InRelease
#5 2.744 Get:3 https://esm.ubuntu.com trusty-infra-security/main amd64 Packages
#5 6.064 Get:4 https://esm.ubuntu.com trusty-infra-updates/main amd64 Packages
#5 84.64 Err http://archive.ubuntu.com trusty InRelease
#5 84.64
#5 84.64 Err http://archive.ubuntu.com trusty-updates InRelease
#5 84.64
#5 84.64 Err http://archive.ubuntu.com trusty-backports InRelease
#5 84.64
#5 84.64 Err http://archive.ubuntu.com trusty Release.gpg
#5 84.64   Unable to connect to archive.ubuntu.com:http: [IP: 91.189.91.39 80]
#5 84.64 Err http://archive.ubuntu.com trusty-updates Release.gpg
#5 84.64   Unable to connect to archive.ubuntu.com:http: [IP: 91.189.91.39 80]
#5 84.64 Err http://archive.ubuntu.com trusty-backports Release.gpg
#5 84.64   Unable to connect to archive.ubuntu.com:http: [IP: 91.189.91.39 80]
#5 84.65 Err http://security.ubuntu.com trusty-security InRelease
#5 84.65
#5 84.65 Err http://security.ubuntu.com trusty-security Release.gpg
#5 84.65   Unable to connect to security.ubuntu.com:http: [IP: 91.189.91.39 80]
#5 84.65 Fetched 680 kB in 1min 24s (8076 B/s)
#5 84.65 Reading package lists...
#5 84.78 W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/trusty/InRelease
#5 84.78
#5 84.78 W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/trusty-updates/InRelease
#5 84.78
#5 84.78 W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/trusty-backports/InRelease
#5 84.78
#5 84.78 W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/trusty-security/InRelease
#5 84.78
#5 84.78 W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/trusty/Release.gpg  Unable to connect to archive.ubuntu.com:http: [IP: 91.189.91.39 80]
#5 84.78
#5 84.78 W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/trusty-updates/Release.gpg  Unable to connect to archive.ubuntu.com:http: [IP: 91.189.91.39 80]
#5 84.78
#5 84.78 W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/trusty-backports/Release.gpg  Unable to connect to archive.ubuntu.com:http: [IP: 91.189.91.39 80]
#5 84.78
#5 84.78 W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/trusty-security/Release.gpg  Unable to connect to security.ubuntu.com:http: [IP: 91.189.91.39 80]
#5 84.78
#5 84.78 W: Some index files failed to download. They have been ignored, or old ones used instead.
#5 84.78 Reading package lists...
#5 84.90 Building dependency tree...
#5 84.92 Reading state information...
#5 84.92 Package liblz4-tool is not available, but is referred to by another package.
#5 84.92 This may mean that the package is missing, has been obsoleted, or
#5 84.92 is only available from another source
#5 84.92
#5 84.92 Package mingw-w64 is not available, but is referred to by another package.
#5 84.92 This may mean that the package is missing, has been obsoleted, or
#5 84.92 is only available from another source
#5 84.92
#5 84.92 E: Unable to locate package dos2unix
#5 84.92 E: Unable to locate package enca
#5 84.92 E: Unable to locate package upx
#5 84.92 E: Unable to locate package pngquant
#5 84.92 E: Unable to locate package mingw32
#5 84.92 E: Unable to locate package mtd-utils
#5 84.92 E: Package 'liblz4-tool' has no installation candidate
#5 84.92 E: Package 'mingw-w64' has no installation candidate
------
executor failed running [/bin/sh -c apt-get update -q && apt-get install -y -q     bash-completion     bc     bison     build-essential     cpio     curl     dos2unix     enca     flex     gawk     gcc-multilib     gettext     git-core     g++-multilib     gnupg     gperf     libc6-dev-i386     libx11-dev     lib32ncurses5-dev     lib32z1     nano     python     rsync     subversion     sudo     texinfo     tofrodos     wget     x11proto-core-dev     zip     zlib1g-dev     make     libc6     lib32stdc++6     zlib1g-dev     ncurses-term     libncursesw5-dev     g++     u-boot-tools     texinfo     texlive     gawk     upx     pngquant     libgl1-mesa-dev     mingw32     lib32bz2-1.0     mtd-utils     vim     squashfs-tools     cmake     liblz4-tool     device-tree-compiler     mingw-w64  && rm -rf /var/lib/apt/lists/*]: exit code: 100

```

后续更新软件源,更换不同网络环境后,构建OK。