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.
2
Answers
This answer eventually solved my problem. i.e. putting the below code before
RUN apt-get update
Found this answer from here
https://forums.docker.com/t/hash-sum-mismatch-writing-more-data-as-expected/45940/2
This bothered me for a day