Getting error while building a dockerfile on Mac M1 pro.
Dockerfile
FROM python:3.8-slim
RUN apt-get update
RUN apt-get -y upgrade
RUN apt-get -yqq install gcc
error I am getting
=> CACHED [3/4] RUN apt-get -y upgrade 0.0s
=> ERROR [4/4] RUN apt-get -yqq install gcc 37.3s
------
> [4/4] RUN apt-get -yqq install gcc:
#7 37.30 E: Failed to fetch http://deb.debian.org/debian/pool/main/g/gcc-10/libasan6_10.2.1-6_arm64.deb 500 reading HTTP response body: unexpected EOF [IP: 199.232.22.132 80]
#7 37.30 E: Failed to fetch http://deb.debian.org/debian/pool/main/g/gcc-10/libtsan0_10.2.1-6_arm64.deb 500 reading HTTP response body: unexpected EOF [IP: 199.232.22.132 80]
#7 37.30 E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?
------
executor failed running [/bin/sh -c apt-get -yqq install gcc]: exit code: 100
The same dockerfile work perfectly on intel based mac. Any help would be highly appreciated.
I tried to build it for amd64 platform as well. it gives the same error. The only solution I came up with was to manually download the package and then install it using apt. This seems to work, but it is a cumbersome process as there are a lot of package which is giving me this issue.
If it happens only on the M1 Mac, I can only think of something with the architecture even when you build amd64 image since in that case you need emulation which is usually less stable than building for the architecture of the host. Or something is installed on the M1 Mac or just the network is less stable (unless it is the same network)
I have a MacBook Air M1 and I could build the image using the Dockerfile you shared without any error message.
I used wget from the container to download the packages it is unable to fetch and then ran apt install.
On running the command provided, I got this output.
root@944cb4833522:/# curl -vvv --output package.deb -L http://deb.debian.org/debian/pool/main/g/gcc-10/libtsan0_10.2.1-6_arm64.deb
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0* Trying 199.232.106.132:80...
* Connected to deb.debian.org (199.232.106.132) port 80 (#0)
> GET /debian/pool/main/g/gcc-10/libtsan0_10.2.1-6_arm64.deb HTTP/1.1
> Host: deb.debian.org
> User-Agent: curl/7.74.0
> Accept: */*
>
* Mark bundle as not supporting multiuse
< HTTP/1.1 200 OK
< Connection: close
< Content-Length: 1957408
< Accept-Ranges: bytes
< Age: 794858
< Cache-Control: public, max-age=2592000
< Content-Type: application/x-debian-package
< Date: Mon, 20 Mar 2023 04:06:30 GMT
< Etag: "1dde20-5b897b9892b10"
< Last-Modified: Mon, 11 Jan 2021 03:44:35 GMT
< Permissions-Policy: interest-cohort=()
< Referrer-Policy: no-referrer
< Server: Apache
< Via: 1.1 varnish, 1.1 varnish
< X-Cache: HIT, HIT
< X-Cache-Hits: 1, 1
< X-Clacks-Overhead: GNU Terry Pratchett
< X-Content-Type-Options: nosniff
< X-Frame-Options: sameorigin
< X-Served-By: cache-ams21072-AMS, cache-del21733-DEL
< X-Timer: S1679285191.952019,VS0,VE1
< X-Xss-Protection: 1
<
{ [40296 bytes data]
100 1911k 100 1911k 0 0 3261k 0 --:--:-- --:--:-- --:--:-- 3256k
* Closing connection 0
Yes, my Intel Mac and Arm Mac are both on the same network. However, I do notice that in each subsequent run there is some shuffling in the list of packages that it is not able to fetch but no such issue on my intel mac.
Any help whatsoever will be highly appreciated.
It is possible that some components of Docker Desktop are less stable on arm64 than on amd64. I remember network issues from the past on my Mac, but that was long ago