dockerfile build apt-get update 期间出错 [重复]

Posted

技术标签:

【中文标题】dockerfile build apt-get update 期间出错 [重复]【英文标题】:ERROR during dockerfile build apt-get update [duplicate] 【发布时间】:2021-12-04 03:40:48 【问题描述】:

我试图在 Mac 中使用 dockerfile 安装 oracle 但我遇到了麻烦请帮忙!!

我在 MAC docker build --no-cache -t orange:002 /Users/1234 中有命令

这是我的 docker 文件

FROM jaspeen/oracle-xe-11g
RUN apt-get update && apt-get upgrade
RUN apt-get install vim -common
ENV LC_ALL-C.UTF-8

我的错误代码是

[+] Building 84.2s (5/6)                                                                                               
 => [internal] load build definition from Dockerfile                                                              0.0s
 => => transferring dockerfile: 37B                                                                               0.0s
 => [internal] load .dockerignore                                                                                 0.0s
 => => transferring context: 2B                                                                                   0.0s
 => [internal] load metadata for docker.io/jaspeen/oracle-xe-11g:latest                                           3.1s
 => [1/3] FROM docker.io/jaspeen/oracle-xe-11g@sha256:0a4b0456cd5be4982ab28ca9426672acee6d90734873d15124698c5c0  43.9s
 => => resolve docker.io/jaspeen/oracle-xe-11g@sha256:0a4b0456cd5be4982ab28ca9426672acee6d90734873d15124698c5c07  0.0s
 => => extracting sha256:05b9ddeb40d9a21312cbfb42f8ab49d642744556ef66139c11a181d278b4c733                     
    0.0s
 => => sha256:863735b9fd15b7617298df56e767c6057c4439df896d1d4b0e5e09fa50377496 65.67MB / 65.67MB                  0.0s
 => => sha256:05b9ddeb40d9a21312cbfb42f8ab49d642744556ef66139c11a181d278b4c733 413B / 413B                        0.0s
 => => sha256:740047056d21b8e72188f462f10d69f0ae931609c7397bd9f488cc2593d5d997 1.13kB / 1.13kB                    0.0s
 => => sha256:fbfc89a21b1b1aba3bcf0d397994f89bdf601c3ad887e3c5f1f4d2d11862ae1d 322.70MB / 322.70MB                0.0s
 => => sha256:4fbaa2f403dffcc9050448f94c0e0b32d1a12b74379738a53a69e686cce4da7e 71.48kB / 71.48kB                  0.0s
 => => sha256:44be94a95984bb47dc3a193f59bf8c04d5e877160b745b119278f38753a6f58f 681B / 681B                        0.0s
 => => sha256:b44894d2d2af206ab91533afeeae4fc989796c42738d250bba039fc04a2bd5cc 537B / 537B                        0.0s
 => => sha256:1492d1fc5b9fe0774e4e9930af562342cd00fb0b9059d1f9088fa14b5cadb118 684B / 684B                        0.0s
 => => sha256:c0f3c6ec8986d3703be62cf8f0faf0cb9d20c12de9330c3585edadf9b3d0d956 687B / 687B                        0.0s
 => => extracting sha256:b44894d2d2af206ab91533afeeae4fc989796c42738d250bba039fc04a2bd5cc                         0.0s
 => => extracting sha256:1492d1fc5b9fe0774e4e9930af562342cd00fb0b9059d1f9088fa14b5cadb118                         0.0s
 => => extracting sha256:c0f3c6ec8986d3703be62cf8f0faf0cb9d20c12de9330c3585edadf9b3d0d956                         0.0s
 => => extracting sha256:fbfc89a21b1b1aba3bcf0d397994f89bdf601c3ad887e3c5f1f4d2d11862ae1d                        13.1s
 => => extracting sha256:740047056d21b8e72188f462f10d69f0ae931609c7397bd9f488cc2593d5d997                         0.0s
 => ERROR [2/3] RUN apt-get update && apt-get upgrade                                                            36.8s
------                                                                                                                 
 > [2/3] RUN apt-get update && apt-get upgrade:                                                                        
#5 3.533 Ign http://archive.ubuntu.com trusty InRelease                                                                
#5 3.842 Get:1 http://archive.ubuntu.com trusty-updates InRelease [65.9 kB]                                            
#5 5.694 Get:2 http://archive.ubuntu.com trusty-security InRelease [65.9 kB]                                           
#5 6.389 Get:3 http://archive.ubuntu.com trusty Release.gpg [933 B]                                                    
#5 6.645 Get:4 http://archive.ubuntu.com trusty-updates/main Sources [532 kB]
#5 8.773 Get:5 http://archive.ubuntu.com trusty-updates/restricted Sources [6444 B]
#5 8.773 Get:6 http://archive.ubuntu.com trusty-updates/universe Sources [288 kB]
#5 8.865 Get:7 http://archive.ubuntu.com trusty-updates/main amd64 Packages [1460 kB]
#5 9.785 Get:8 http://archive.ubuntu.com trusty-updates/restricted amd64 Packages [21.4 kB]
#5 10.09 Get:9 http://archive.ubuntu.com trusty-updates/universe amd64 Packages [671 kB]
#5 14.19 Get:10 http://archive.ubuntu.com trusty Release [58.5 kB]
#5 14.50 Get:11 http://archive.ubuntu.com trusty-security/main Sources [220 kB]
#5 15.11 Get:12 http://archive.ubuntu.com trusty-security/restricted Sources [5050 B]
#5 15.52 Get:13 http://archive.ubuntu.com trusty-security/universe Sources [127 kB]
#5 17.06 Get:14 http://archive.ubuntu.com trusty-security/main amd64 Packages [1032 kB]
#5 18.60 Get:15 http://archive.ubuntu.com trusty-security/restricted amd64 Packages [18.1 kB]
#5 18.91 Get:16 http://archive.ubuntu.com trusty-security/universe amd64 Packages [378 kB]
#5 19.46 Get:17 http://archive.ubuntu.com trusty/main Sources [1335 kB]
#5 20.98 Get:18 http://archive.ubuntu.com trusty/restricted Sources [5335 B]

#5 21.36 Get:19 http://archive.ubuntu.com trusty/universe Sources [7926 kB]
#5 24.75 Get:20 http://archive.ubuntu.com trusty/main amd64 Packages [1743 kB]
#5 25.44 Get:21 http://archive.ubuntu.com trusty/restricted amd64 Packages [16.0 kB]
#5 25.75 Get:22 http://archive.ubuntu.com trusty/universe amd64 Packages [7589 kB]
#5 28.45 Fetched 23.6 MB in 25s (921 kB/s)
#5 28.45 Reading package lists...
#5 31.81 Reading package lists...
#5 34.52 Building dependency tree...
#5 34.70 Reading state information...
#5 35.09 The following packages have been kept back:
#5 35.09   ubuntu-minimal
#5 35.09 The following packages will be upgraded:
#5 35.09   apt apt-utils base-files bash bsdutils busybox-initramfs ca-certificates
#5 35.09   coreutils cpio curl dpkg eject file gcc-4.8-base gcc-4.9-base gnupg gpgv
#5 35.09   ifupdown init-system-helpers initramfs-tools initramfs-tools-bin initscripts
#5 35.09   iproute2 isc-dhcp-client isc-dhcp-common klibc-utils kmod krb5-locales
#5 35.09   libapt-inst1.5 libapt-pkg4.12 libasn1-8-heimdal libblkid1 libc-bin libc6
#5 35.09   libcurl3 libdb5.3 libdbus-1-3 libdrm2 libexpat1 libffi6 libgcc1 libgcrypt11
#5 35.09   libgnutls-openssl27 libgnutls26 libgssapi-krb5-2 libgssapi3-heimdal
#5 35.09   libhcrypto4-heimdal libheimbase1-heimdal libheimntlm0-heimdal
#5 35.09   libhx509-5-heimdal libidn11 libk5crypto3 libklibc libkmod2
#5 35.09   libkrb5-26-heimdal libkrb5-3 libkrb5support0 libldap-2.4-2 libmagic1
#5 35.09   libmount1 libpam-modules libpam-modules-bin libpam-runtime libpam0g libpcre3
#5 35.09   libplymouth2 libpng12-0 libprocps3 libpython3.4-minimal libpython3.4-stdlib
#5 35.09   libroken18-heimdal librtmp0 libsqlite3-0 libssl1.0.0 libstdc++6 libtasn1-6
#5 35.09   libudev1 libuuid1 libwind0-heimdal login logrotate lsb-base lsb-release
#5 35.09   makedev module-init-tools mount mountall multiarch-support ntpdate openssl
#5 35.09   passwd perl perl-base perl-modules plymouth procps python3.4
#5 35.09   python3.4-minimal resolvconf rsyslog sensible-utils sudo sysv-rc
#5 35.09   sysvinit-utils tar tzdata udev util-linux vim-common vim-tiny zlib1g
#5 36.77 111 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.
#5 36.77 Need to get 36.3 MB of archives.
#5 36.77 After this operation, 220 kB of additional disk space will be used.
#5 36.77 Do you want to continue? [Y/n] Abort.
------
executor failed running [/bin/sh -c apt-get update && apt-get upgrade]: exit code: 1

【问题讨论】:

【参考方案1】:

如下更新你的 Dockerfile

FROM jaspeen/oracle-xe-11g
RUN apt-get update && apt-get -y upgrade
RUN apt-get install -y vim-common
ENV LC_ALL-C.UTF-8

这样,apt-get 不会提示Do you want to continue? [Y/n],apt-get 会自动升级,无需用户干预。

【讨论】:

以上是关于dockerfile build apt-get update 期间出错 [重复]的主要内容,如果未能解决你的问题,请参考以下文章

在docker build过程中执行apt-get update时报错"Could not connect to archive.ubuntu.com:80"如何处理?

Docker ubuntu apt-get更换国内源解决Dockerfile构建速度过慢

是否可以在Dockerfile中使用apt-get clean两次?

dockerfile---apt-get install vim 时 Unable to locate package vim

004Docker学习__Dockerfile_build命令构建docker镜像

Dockerfile的理解