How to fix 'Hash Sum Mismatch' in Docker on mac - docker

I'm using macOS 11.4 and Docker 3.3.3. My docker file looks like
FROM python:3.8.10-slim-buster
RUN apt-get update && apt-get install --no-install-recommends -y \
# dependencies for building Python packages
build-essential \
# psycopg2 dependencies
libpq-dev
I have tried for different tags of Docker images by Python and have tried to create the image with --no-cache command as well, but every time I try to build image, I get the error Hash Sum mismatch
Here are my logs:
[+] Building 5.8s (5/5) FINISHED
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 247B 0.0s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 34B 0.0s
=> [internal] load metadata for docker.io/library/python:3.8.10-slim-buster 2.6s
=> CACHED [1/2] FROM docker.io/library/python:3.8.10-slim-buster#sha256:c9dc8cd1171771e7f0def12be61d7bb340480e73b4e78acf3464ed0c3347dabd 0.0s
=> ERROR [2/2] RUN apt-get update && apt-get install --no-install-recommends -y build-essential libpq-dev 3.1s
------
> [2/2] RUN apt-get update && apt-get install --no-install-recommends -y build-essential libpq-dev:
#5 0.751 Get:1 http://deb.debian.org/debian buster InRelease [121 kB]
#5 0.751 Get:2 http://security.debian.org/debian-security buster/updates InRelease [65.4 kB]
#5 0.967 Get:3 http://deb.debian.org/debian buster-updates InRelease [51.9 kB]
#5 1.155 Get:4 http://deb.debian.org/debian buster/main amd64 Packages [7907 kB]
#5 1.204 Get:5 http://security.debian.org/debian-security buster/updates/main amd64 Packages [290 kB]
#5 2.833 Err:4 http://deb.debian.org/debian buster/main amd64 Packages
#5 2.833 Hash Sum mismatch
#5 2.833 Hashes of expected file:
#5 2.833 - Filesize:7906864 [weak]
#5 2.833 - SHA256:935deda18d5bdc25fb1813d0ec99b6e0e32a084b203e518af0cf7dc79ee8ebda
#5 2.833 - MD5Sum:ba791e511a2a4b6523ac06f404e32f42 [weak]
#5 2.833 Hashes of received file:
#5 2.833 - SHA256:3dbff74a7005b0214ed17ad72a4724cb91919d8d0221b5297f98f6153606bcaa
#5 2.833 - MD5Sum:f24d4da07e9d1e5bccd9d324cb36dd20 [weak]
#5 2.833 - Filesize:7906864 [weak]
#5 2.833 Last modification reported: Sat, 27 Mar 2021 09:33:56 +0000
#5 2.833 Release file created at: Sat, 27 Mar 2021 09:55:13 +0000
#5 3.000 Get:6 http://deb.debian.org/debian buster-updates/main amd64 Packages [10.9 kB]
#5 3.020 Fetched 8447 kB in 3s (3163 kB/s)
#5 3.020 Reading package lists...
#5 3.053 E: Failed to fetch http://deb.debian.org/debian/dists/buster/main/binary-amd64/by-hash/SHA256/935deda18d5bdc25fb1813d0ec99b6e0e32a084b203e518af0cf7dc79ee8ebda Hash Sum mismatch
#5 3.053 Hashes of expected file:
#5 3.053 - Filesize:7906864 [weak]
#5 3.053 - SHA256:935deda18d5bdc25fb1813d0ec99b6e0e32a084b203e518af0cf7dc79ee8ebda
#5 3.053 - MD5Sum:ba791e511a2a4b6523ac06f404e32f42 [weak]
#5 3.053 Hashes of received file:
#5 3.053 - SHA256:3dbff74a7005b0214ed17ad72a4724cb91919d8d0221b5297f98f6153606bcaa
#5 3.053 - MD5Sum:f24d4da07e9d1e5bccd9d324cb36dd20 [weak]
#5 3.053 - Filesize:7906864 [weak]
#5 3.053 Last modification reported: Sat, 27 Mar 2021 09:33:56 +0000
#5 3.053 Release file created at: Sat, 27 Mar 2021 09:55:13 +0000
#5 3.053 E: Some index files failed to download. They have been ignored, or old ones used instead.
------
executor failed running [/bin/sh -c apt-get update && apt-get install --no-install-recommends -y build-essential libpq-dev]: exit code: 100
Any kind of help is greatly appreciated.
Thanks in advance.

This answer eventually solved my problem. i.e. putting the below code before RUN apt-get update
RUN rm -rf /var/lib/apt/lists/*
RUN apt-get clean
RUN apt-get update -o Acquire::CompressionTypes::Order::=gz

Related

Error building docker image for a simple rust application: extra-runtime-dependencies package not found?

Anyone try building a rust image using the directions on docker hub? https://hub.docker.com/_/rust
FROM rust:1.40 as builder
WORKDIR /usr/src/myapp
COPY . .
RUN cargo install --path .
FROM debian:buster-slim
RUN apt-get update && apt-get install -y extra-runtime-dependencies && rm -rf /var/lib/apt/lists/*
COPY --from=builder /usr/local/cargo/bin/myapp /usr/local/bin/myapp
CMD ["myapp"]
When I tried to build it using docker build -t myapp, I got an error:
=> CACHED [stage-1 1/3] FROM docker.io/library/debian:buster-slim#sha256:5dbce817ee72802025a38a388237b0ea576aa16 0.0s
=> ERROR [stage-1 2/3] RUN apt-get update && apt-get install -y extra-runtime-dependencies && rm -rf /var/lib/ap 5.4s
------
> [stage-1 2/3] RUN apt-get update && apt-get install -y extra-runtime-dependencies && rm -rf /var/lib/apt/lists/*:
#6 0.617 Get:1 http://deb.debian.org/debian buster InRelease [122 kB]
#6 0.698 Get:2 http://deb.debian.org/debian-security buster/updates InRelease [34.8 kB]
#6 0.731 Get:3 http://deb.debian.org/debian buster-updates InRelease [56.6 kB]
#6 0.875 Get:4 http://deb.debian.org/debian buster/main amd64 Packages [7909 kB]
#6 1.700 Get:5 http://deb.debian.org/debian-security buster/updates/main amd64 Packages [397 kB]
#6 1.734 Get:6 http://deb.debian.org/debian buster-updates/main amd64 Packages [8788 B]
#6 2.708 Fetched 8529 kB in 2s (3802 kB/s)
#6 2.708 Reading package lists...
#6 3.432 Reading package lists...
#6 4.230 Building dependency tree...
#6 4.443 Reading state information...
#6 4.571 E: Unable to locate package extra-runtime-dependencies
------
executor failed running [/bin/sh -c apt-get update && apt-get install -y extra-runtime-dependencies && rm -rf /var/lib/apt/lists/*]: exit code: 100
The rust documentation needs clarification on this, but extra-runtime-dependencies is a placeholder. Explanation is here

docker cannot build image mac

My mac is Apple M1
Content in my dockerfile:
FROM --platform=linux/amd64 golang:1.18
RUN set -x; \ export DEBIAN_FRONTEND=noninteractive; \ echo "deb
http://ppa.launchpad.net/bpaquet/zeromq4-precise/ubuntu precise main "
/etc/apt/sources.list \ && apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys FF160426C4832F92 \ &&
apt-get update \ && apt-get install -y \
libzmq1=4.0.4-bpa~precise1 \
libzmq-dev=4.0.4-bpa~precise1 \
pkg-config
ENV PATH /go/bin:$PATH ENV GOPROJECTPATH /go/src/emitter COPY .
$GOPROJECTPATH WORKDIR $GOPROJECTPATH
RUN go get -v
CMD ["bash"]
but once I run build image command:
docker build --tag docker-emitter-org .
I have this error in my terminal
[+] Building 52.9s (6/9)
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 606B 0.0s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> [internal] load metadata for docker.io/library/golang:1.18 1.8s
=> [1/5] FROM docker.io/library/golang:1.18#sha256:040bc0980888e2df09499c73156f3f869d843b7033d11b465fee7f1a358a494a 33.6s
=> => resolve docker.io/library/golang:1.18#sha256:040bc0980888e2df09499c73156f3f869d843b7033d11b465fee7f1a358a494a 0.0s
=> => sha256:040bc0980888e2df09499c73156f3f869d843b7033d11b465fee7f1a358a494a 2.36kB / 2.36kB 0.0s
=> => sha256:23858da423a6737f0467fab0014e5b53009ea7405d575636af0c3f100bbb2f10 55.03MB / 55.03MB 8.4s
=> => sha256:a42821cd14fb31c4aa253203e7f8e34fc3b15d69ce370f1223fbbe4252a64202 10.88MB / 10.88MB 5.3s
=> => sha256:ebd59a91af0c61cf28a22a9651ffd45612848bdcc1a43c2c3063825ba2e613fc 1.80kB / 1.80kB 0.0s
=> => sha256:f81bafb819d5b520ab919b42e5925c4b32b62241fc1d036036d9bb5aa2f522d1 7.10kB / 7.10kB 0.0s
=> => sha256:326f452ade5c33097eba4ba88a24bd77a93a3d994d4dc39b936482655e664857 5.16MB / 5.16MB 3.1s
=> => sha256:8471b75885efc7790a16be5328e3b368567b76a60fc3feabd6869c15e175ee05 54.58MB / 54.58MB 16.2s
=> => sha256:b7aa120dd02d9fa75bb50861103f7837514028ea6f06e3e821b8c47c2c10d386 85.96MB / 85.96MB 23.0s
=> => extracting sha256:23858da423a6737f0467fab0014e5b53009ea7405d575636af0c3f100bbb2f10 1.6s
=> => sha256:5cc67fe6144b8a2d33963edb62297bdaa3f968746061866b48db3f3125e68734 141.88MB / 141.88MB 29.3s
=> => extracting sha256:326f452ade5c33097eba4ba88a24bd77a93a3d994d4dc39b936482655e664857 0.1s
=> => extracting sha256:a42821cd14fb31c4aa253203e7f8e34fc3b15d69ce370f1223fbbe4252a64202 0.2s
=> => extracting sha256:8471b75885efc7790a16be5328e3b368567b76a60fc3feabd6869c15e175ee05 1.7s
=> => sha256:cd3416ecab879296d41843948ae859cadb4bd4300a60b23abef443645845ab4a 156B / 156B 16.4s
=> => extracting sha256:b7aa120dd02d9fa75bb50861103f7837514028ea6f06e3e821b8c47c2c10d386 2.2s
=> => extracting sha256:5cc67fe6144b8a2d33963edb62297bdaa3f968746061866b48db3f3125e68734 3.8s
=> => extracting sha256:cd3416ecab879296d41843948ae859cadb4bd4300a60b23abef443645845ab4a 0.0s
=> [internal] load build context 0.0s
=> => transferring context: 876B 0.0s
=> ERROR [2/5] RUN set -x; export DEBIAN_FRONTEND=noninteractive; echo "deb http://ppa.launchpad.net/bpaquet/zeromq4-precise/ubuntu precise main " >> / 17.5s
------
> [2/5] RUN set -x; export DEBIAN_FRONTEND=noninteractive; echo "deb http://ppa.launchpad.net/bpaquet/zeromq4-precise/ubuntu precise main " >> /etc/apt/sources.list && apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys FF160426C4832F92 && apt-get update && apt-get install -y libzmq1=4.0.4-bpa~precise1 libzmq-dev=4.0.4-bpa~precise1 pkg-config:
#4 0.202 + export DEBIAN_FRONTEND=noninteractive
#4 0.207 + echo deb http://ppa.launchpad.net/bpaquet/zeromq4-precise/ubuntu precise main
#4 0.208 + apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys FF160426C4832F92
#4 0.897 Warning: apt-key is deprecated. Manage keyring files in trusted.gpg.d instead (see apt-key(8)).
#4 1.397 Executing: /tmp/apt-key-gpghome.aCEKfc6dIj/gpg.1.sh --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys FF160426C4832F92
#4 1.841 gpg: key FF160426C4832F92: public key "Launchpad PPA for Bertrand Paquet" imported
#4 1.879 gpg: Total number processed: 1
#4 1.879 gpg: imported: 1
#4 5.851 + apt-get update
#4 6.159 Get:1 http://deb.debian.org/debian bullseye InRelease [116 kB]
#4 6.193 Ign:2 http://ppa.launchpad.net/bpaquet/zeromq4-precise/ubuntu precise InRelease
#4 6.251 Get:3 http://deb.debian.org/debian-security bullseye-security InRelease [48.4 kB]
#4 6.251 Get:4 http://deb.debian.org/debian bullseye-updates InRelease [44.1 kB]
#4 6.264 Get:5 http://ppa.launchpad.net/bpaquet/zeromq4-precise/ubuntu precise Release [11.9 kB]
#4 6.354 Get:6 http://ppa.launchpad.net/bpaquet/zeromq4-precise/ubuntu precise Release.gpg [316 B]
#4 7.634 Get:7 http://deb.debian.org/debian bullseye/main amd64 Packages [8184 kB]
#4 9.254 Get:8 http://deb.debian.org/debian-security bullseye-security/main amd64 Packages [184 kB]
#4 10.32 Get:9 http://deb.debian.org/debian bullseye-updates/main amd64 Packages [2596 B]
#4 11.57 Ign:6 http://ppa.launchpad.net/bpaquet/zeromq4-precise/ubuntu precise Release.gpg
#4 14.66 Reading package lists...
#4 16.99 W: GPG error: http://ppa.launchpad.net/bpaquet/zeromq4-precise/ubuntu precise Release: The following signatures were invalid: E9F21DF686E307024F2EE2B7FF160426C4832F92
#4 16.99 E: The repository 'http://ppa.launchpad.net/bpaquet/zeromq4-precise/ubuntu precise Release' is not signed.
------
executor failed running [/bin/sh -c set -x; export DEBIAN_FRONTEND=noninteractive; echo "deb http://ppa.launchpad.net/bpaquet/zeromq4-precise/ubuntu precise main " >> /etc/apt/sources.list && apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys FF160426C4832F92 && apt-get update && apt-get install -y libzmq1=4.0.4-bpa~precise1 libzmq-dev=4.0.4-bpa~precise1 pkg-config]: exit code: 100
it says
GPG error: http://ppa.launchpad.net/bpaquet/zeromq4-precise/ubuntu
precise Release: The following signatures were invalid:
E9F21DF686E307024F2EE2B7FF160426C4832F92
#4 16.99 E: The repository 'http://ppa.launchpad.net/bpaquet/zeromq4-precise/ubuntu precise
Release' is not signed.
I really do not know what it mean and wondering how to fix and pass the build.
thanks

Dockerfile error: The repository 'http://dl.google.com/linux/chrome/deb stable InRelease' is not signed

This dockerfile works when line 4 (case 1) is uncommented, but fails when line 5 (case 2) is uncommented. I have very puzzled by this. The error (if I understand it) should happen in both cases. See the error trace below.
Dockerfile - Case 1 works, case 2 fails
# This is an auto generated Dockerfile for ros:ros-core
# generated from docker_images/create_ros_core_image.Dockerfile.em
# Case 1: Works FROM ubuntu:focal
# Case 2: Gives error FROM dorowu/ubuntu-desktop-lxde-vnc:focal
# setup timezone
RUN apt-get update && \
apt-get install -q -y --no-install-recommends tzdata && \
rm -rf /var/lib/apt/lists/*
# install packages
RUN apt-get update && apt-get install -q -y --no-install-recommends \
dirmngr \
gnupg2 \
&& rm -rf /var/lib/apt/lists/*
# setup sources.list
RUN echo "deb http://packages.ros.org/ros/ubuntu focal main" > /etc/apt/sources.list.d/ros1-latest.list
# setup keys
RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654
# setup environment
ENV LANG C.UTF-8
ENV LC_ALL C.UTF-8
ENV ROS_DISTRO noetic
# install ros packages
RUN apt-get update && apt-get install -y --no-install-recommends \
ros-noetic-ros-core=1.5.0-1* \
&& rm -rf /var/lib/apt/lists/*
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \
ros-noetic-desktop-full
Error Trace
+] Building 0.9s (6/11)
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 1.21kB 0.0s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> [internal] load metadata for docker.io/dorowu/ubuntu-desktop-lxde-vnc:focal 0.5s
=> [auth] dorowu/ubuntu-desktop-lxde-vnc:pull token for registry-1.docker.io 0.0s
=> CACHED [1/7] FROM docker.io/dorowu/ubuntu-desktop-lxde-vnc:focal#sha256:07e51eafb 0.0s
=> ERROR [2/7] RUN echo 'Etc/UTC' > /etc/timezone && ln -s /usr/share/zoneinfo/E 0.3s
------
> [2/7] RUN echo 'Etc/UTC' > /etc/timezone && ln -s /usr/share/zoneinfo/Etc/UTC /etc/localtime && apt-get update && apt-get install -q -y --no-install-recommends tzdata && rm -rf /var/lib/apt/lists/*:
#6 0.307 ln: failed to create symbolic link '/etc/localtime': File exists
------
executor failed running [/bin/sh -c echo 'Etc/UTC' > /etc/timezone && ln -s /usr/share/zoneinfo/Etc/UTC /etc/localtime && apt-get update && apt-get install -q -y --no-install-recommends tzdata && rm -rf /var/lib/apt/lists/*]: exit code: 1
~/mydev/dockerplay docker build -t dockerplay3 .
[+] Building 18.5s (5/10)
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 1.11kB 0.0s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> [internal] load metadata for docker.io/dorowu/ubuntu-desktop-lxde-vnc:focal 0.2s
=> CACHED [1/7] FROM docker.io/dorowu/ubuntu-desktop-lxde-vnc:focal#sha256:07e51eafb 0.0s
=> ERROR [2/7] RUN apt-get update && apt-get install -q -y --no-install-recomme 18.2s
------
> [2/7] RUN apt-get update && apt-get install -q -y --no-install-recommends tzdata && rm -rf /var/lib/apt/lists/*:
#5 1.045 Get:1 http://dl.google.com/linux/chrome/deb stable InRelease [1811 B]
#5 1.046 Get:2 http://security.ubuntu.com/ubuntu focal-security InRelease [114 kB]
#5 1.136 Get:3 http://mirrors.ubuntu.com/mirrors.txt Mirrorlist [3393 B]
#5 1.498 Get:4 http://ubuntu.mirror.frontiernet.net/ubuntu focal InRelease [265 kB]
#5 1.612 Ign:6 https://atl.mirrors.clouvider.net/ubuntu focal-backports InRelease
#5 1.651 Get:5 http://mirrors.xmission.com/ubuntu focal-updates InRelease [114 kB]
#5 1.817 Get:6 http://mirrors.gigenet.com/ubuntuarchive focal-backports InRelease [108 kB]
#5 2.547 Err:1 http://dl.google.com/linux/chrome/deb stable InRelease
#5 2.547 The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 4EB27DB2A3B88B8B
#5 3.783 Get:7 http://security.ubuntu.com/ubuntu focal-security/main amd64 Packages [2031 kB]
#5 4.116 Get:8 http://security.ubuntu.com/ubuntu focal-security/multiverse amd64 Packages [27.5 kB]
#5 4.120 Get:9 http://security.ubuntu.com/ubuntu focal-security/universe amd64 Packages [883 kB]
#5 4.229 Get:10 http://security.ubuntu.com/ubuntu focal-security/restricted amd64 Packages [1398 kB]
#5 5.734 Get:13 http://mirror.team-cymru.com/ubuntu focal/universe amd64 Packages [11.3 MB]
#5 5.738 Get:11 http://mirror.uoregon.edu/ubuntu focal/restricted amd64 Packages [33.4 kB]
#5 5.772 Get:14 http://mirrors.arpnetworks.com/Ubuntu focal/multiverse amd64 Packages [177 kB]
#5 5.881 Ign:12 https://mirror.us.leaseweb.net/ubuntu focal/main amd64 Packages
#5 6.256 Get:12 http://mirror.metrocast.net/ubuntu focal/main amd64 Packages [1275 kB]
#5 6.749 Ign:15 http://ftp.usf.edu/pub/ubuntu focal-updates/restricted amd64 Packages
#5 6.837 Ign:15 http://mirrors.arpnetworks.com/Ubuntu focal-updates/restricted amd64 Packages
#5 6.967 Get:17 http://mirrors.namecheap.com/ubuntu focal-updates/universe amd64 Packages [1161 kB]
#5 7.214 Ign:16 https://mirrors.ocf.berkeley.edu/ubuntu-ports focal-updates/multiverse amd64 Packages
#5 7.575 Ign:15 https://mirrors.tscak.com/ubuntu focal-updates/restricted amd64 Packages
#5 8.978 Get:18 http://www.gtlib.gatech.edu/pub/ubuntu focal-updates/main amd64 Packages [2479 kB]
#5 9.766 Get:16 http://repo.miserver.it.umich.edu/ubuntu focal-updates/multiverse amd64 Packages [30.2 kB]
#5 9.927 Get:15 http://mirror.us-ny2.kamatera.com/ubuntu focal-updates/restricted amd64 Packages [1511 kB]
#5 10.24 Get:19 http://reflector.westga.edu/repos/Ubuntu/archive focal-backports/main amd64 Packages [54.2 kB]
#5 10.49 Ign:20 http://mirror.enzu.com/ubuntu focal-backports/universe amd64 Packages
#5 10.85 Ign:20 https://ubuntu.mirror.shastacoe.net/ubuntu focal-backports/universe amd64 Packages
#5 11.07 Ign:20 https://mirrors.ocf.berkeley.edu/ubuntu-ports focal-backports/universe amd64 Packages
#5 11.24 Get:20 http://mirror.umd.edu/ubuntu focal-backports/universe amd64 Packages [27.1 kB]
#5 13.98 Reading package lists...
#5 18.18 W: GPG error: http://dl.google.com/linux/chrome/deb stable InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 4EB27DB2A3B88B8B
#5 18.18 E: The repository 'http://dl.google.com/linux/chrome/deb stable InRelease' is not signed.
------
executor failed running [/bin/sh -c apt-get update && apt-get install -q -y --no-install-recommends tzdata && rm -rf /var/lib/apt/lists/*]: exit code: 100
I believe the public keys for the mentioned repository changed recently, or something like that. Quick fix:
wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
Then try again.
I haven't solver this. But I made it go away by removing the lines totally and adding these instead (which I got from another Dockerfile):
RUN apt-get install -y wget
RUN wget -q https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
RUN apt-get install ./google-chrome-stable_current_amd64.deb

Docker ERROR when RUN apt update && apt install -y python3 [duplicate]

This question already exists:
Docker Error when RUN apt install -y python3
Closed last year.
The community reviewed whether to reopen this question last year and left it closed:
Original close reason(s) were not resolved
I am trying to build a new image "first" with a docker file. However, it throws an error with the second line of docker file when I try to build the image.
This is my docker file:
FROM ubuntu:18.10
RUN apt update && apt install -y python3
This is the error message I get:
C:\Users\82104\Desktop\ExerciseFiles>docker build -t first .
[+] Building 2.0s (5/5) FINISHED
=> [internal] load build definition from Dockerfile 0.1s
=> => transferring dockerfile: 98B 0.0s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> [internal] load metadata for docker.io/library/ubuntu:18.10 0.0s
=> CACHED [1/2] FROM docker.io/library/ubuntu:18.10 0.0s
=> ERROR [2/2] RUN apt update && apt install -y python3 1.8s
------
> [2/2] RUN apt update && apt install -y python3:
#5 0.539
#5 0.539 WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
#5 0.539
#5 0.948 Ign:1 http://archive.ubuntu.com/ubuntu cosmic InRelease
#5 0.948 Ign:2 http://security.ubuntu.com/ubuntu cosmic-security InRelease
#5 1.100 Ign:3 http://archive.ubuntu.com/ubuntu cosmic-updates InRelease
#5 1.100 Err:4 http://security.ubuntu.com/ubuntu cosmic-security Release
#5 1.100 404 Not Found [IP: 91.189.88.152 80]
#5 1.252 Ign:5 http://archive.ubuntu.com/ubuntu cosmic-backports InRelease
#5 1.397 Err:6 http://archive.ubuntu.com/ubuntu cosmic Release
#5 1.397 404 Not Found [IP: 91.189.88.142 80]
#5 1.552 Err:7 http://archive.ubuntu.com/ubuntu cosmic-updates Release
#5 1.552 404 Not Found [IP: 91.189.88.142 80]
#5 1.703 Err:8 http://archive.ubuntu.com/ubuntu cosmic-backports Release
#5 1.703 404 Not Found [IP: 91.189.88.142 80]
#5 1.715 Reading package lists...
#5 1.736 E: The repository 'http://security.ubuntu.com/ubuntu cosmic-security Release' does not have a Release file.
#5 1.736 E: The repository 'http://archive.ubuntu.com/ubuntu cosmic Release' does not have a Release file.
#5 1.736 E: The repository 'http://archive.ubuntu.com/ubuntu cosmic-updates Release' does not have a Release file.
#5 1.736 E: The repository 'http://archive.ubuntu.com/ubuntu cosmic-backports Release' does not have a Release file.
------
executor failed running [/bin/sh -c apt update && apt install -y python3]: exit code: 100
Thanks for your help!

Docker build exits with exit code: 1 [duplicate]

This question already has answers here:
The command '/bin/sh -c apt-get install dnsutils' returned a non-zero code: 1
(2 answers)
Closed 1 year ago.
The aim is to have a Docker CLI in a Container, so I can Communicate with the Host Daemon from within this Container. Therefore I wanted to connect the socket's in the run Command.
I have a Dockerfile with the following start. The rest of the build works fine when I omit the Curl and Docker CLI part.
FROM ubuntu:20.04 as build
#might be even more slim, yet has not yet been tested: debian-stable-slim
RUN apt-get update \
&& apt-get install -y wget
RUN apt-get update && \
apt-get -y install sudo
RUN apt-get update && \
apt-get install curl
## Install Docker CLI:
ENV DOCKERVERSION=20.10.9
RUN sudo curl https://download.docker.com/linux/static/stable/x86_64/docker-${DOCKERVERSION}.tgz \
&& tar xzvf docker-${DOCKERVERSION}.tgz --strip 1 \
-C /usr/local/bin docker/docker \
&& rm docker-${DOCKERVERSION}.tgz
This is the build log with error message:
[+] Building 3.2s (8/9)
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 567B 0.0s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> [internal] load metadata for docker.io/library/ubuntu:20.04 1.2s
=> [auth] library/ubuntu:pull token for registry-1.docker.io 0.0s
=> [1/5] FROM docker.io/library/ubuntu:20.04#sha256:626ffe58f6e7566e00254b638eb7e0f3b11d4da9675088f4781a50ae288f3322 0.0s
=> CACHED [2/5] RUN apt-get update && apt-get install -y wget 0.0s
=> CACHED [3/5] RUN apt-get update && apt-get -y install sudo 0.0s
=> ERROR [4/5] RUN apt-get update && apt-get install curl 1.9s
------
> [4/5] RUN apt-get update && apt-get install curl:
#8 0.395 Hit:1 http://archive.ubuntu.com/ubuntu focal InRelease
#8 0.415 Hit:2 http://archive.ubuntu.com/ubuntu focal-updates InRelease
#8 0.441 Hit:3 http://archive.ubuntu.com/ubuntu focal-backports InRelease
#8 0.517 Hit:4 http://security.ubuntu.com/ubuntu focal-security InRelease
#8 0.623 Reading package lists...
#8 1.142 Reading package lists...
#8 1.631 Building dependency tree...
#8 1.733 Reading state information...
#8 1.836 The following additional packages will be installed:
#8 1.836 krb5-locales libasn1-8-heimdal libbrotli1 libcurl4 libgssapi-krb5-2
#8 1.836 libgssapi3-heimdal libhcrypto4-heimdal libheimbase1-heimdal
#8 1.836 libheimntlm0-heimdal libhx509-5-heimdal libk5crypto3 libkeyutils1
#8 1.836 libkrb5-26-heimdal libkrb5-3 libkrb5support0 libldap-2.4-2 libldap-common
#8 1.836 libnghttp2-14 libroken18-heimdal librtmp1 libsasl2-2 libsasl2-modules
#8 1.836 libsasl2-modules-db libsqlite3-0 libssh-4 libwind0-heimdal
#8 1.837 Suggested packages:
#8 1.837 krb5-doc krb5-user libsasl2-modules-gssapi-mit
#8 1.837 | libsasl2-modules-gssapi-heimdal libsasl2-modules-ldap libsasl2-modules-otp
#8 1.837 libsasl2-modules-sql
#8 1.866 The following NEW packages will be installed:
#8 1.867 curl krb5-locales libasn1-8-heimdal libbrotli1 libcurl4 libgssapi-krb5-2
#8 1.867 libgssapi3-heimdal libhcrypto4-heimdal libheimbase1-heimdal
#8 1.867 libheimntlm0-heimdal libhx509-5-heimdal libk5crypto3 libkeyutils1
#8 1.867 libkrb5-26-heimdal libkrb5-3 libkrb5support0 libldap-2.4-2 libldap-common
#8 1.868 libnghttp2-14 libroken18-heimdal librtmp1 libsasl2-2 libsasl2-modules
#8 1.869 libsasl2-modules-db libsqlite3-0 libssh-4 libwind0-heimdal
#8 1.874 0 upgraded, 27 newly installed, 0 to remove and 0 not upgraded.
#8 1.874 Need to get 3197 kB of archives.
#8 1.874 After this operation, 10.5 MB of additional disk space will be used.
#8 1.874 Do you want to continue? [Y/n] Abort.
------
executor failed running [/bin/sh -c apt-get update && apt-get install curl]: exit code: 1
there is no possibility to choose Y/n, because it exits instantly. Has anyone a Idea how to solve this?
Im Using Docker on Windows, Version 20.10.8
Thanks a lot!
apt get install will wait for user input. You're missing the -y flag to allow it to continue without human intervention:
RUN apt-get update && \
apt-get install -y curl

Resources