I am working with a corporate repository mirroring canonical repository. I suspect that this corporate repository is not reliable, because I have sporadic failures such as:
Failed to fetch ... 502 Bad Gateway [IP: ...]
Failed to fetch ... 404 Not Found [IP: ...]
It does not seem to depend on the package to be installed. Taking that into account, I tried to use APT::Acquire::Retries
:
RUN echo 'APT::Acquire::Retries "3";' > /etc/apt/apt.conf.d/80-retries
(and yes, I am building a docker image)
Here's how I am installing the packages:
...
&& apt install --no-install-recommends -y \
curl \
apt-utils \
iputils-ping \
nano \
gridsite-clients\
...
I have the feeling that the APT::Acquire::Retries
is not taken into account (ie by using higher values such as 30 ...).
The base image used is an ubuntu:20.04, with a version of apt equal to apt 2.0.8 (amd64).
Any clues ?
[Edited] By activating the following tweaks on apt.conf, I managed to get rid of 502 errors:
RUN echo '\
Acquire::Retries "100";\
Acquire::https::Timeout "240";\
Acquire::http::Timeout "240";\
APT::Get::Assume-Yes "true";\
APT::Install-Recommends "false";\
APT::Install-Suggests "false";\
Debug::Acquire::https "true";\
' > /etc/apt/apt.conf.d/99custom
In which case (read http status cod errors) Acquire::Retries works ?