I am attempting to build a docker image with the requirements specified in requirements.txt. However, upon trying to build the file, I get the following error:
E: Failed to fetch http://us.archive.ubuntu.com/ubuntu/pool/main/l/linux-atm/libatm1_2.5.1-1.5_amd64.deb 400 Bad Request [IP: 91.189.91.39 80]
E: Failed to fetch http://us.archive.ubuntu.com/ubuntu/pool/main/p/popt/libpopt0_1.16-10_amd64.deb 400 Bad Request [IP: 91.189.91.39 80]
E: Failed to fetch http://us.archive.ubuntu.com/ubuntu/pool/main/libc/libcap-ng/libcap-ng0_0.7.7-1_amd64.deb 400 Bad Request [IP: 91.189.91.39 80]
I have attempted to change the mirror, I have checked the output of cat /etc/apt/sources.list, I have tried to add the flag --fix-missing and tried to build the image with --no-cache all to no avail.
Here is the Dockerfile:
# Base image
FROM ubuntu:16.04
MAINTAINER Siddhanth Ajri "y2jsiddajri@gmail.com"
RUN cat /etc/apt/sources.list
# Changing to US archives of UBUNTU
RUN sed -i'' 's/archive\.ubuntu\.com/us\.archive\.ubuntu\.com/' /etc/apt/sources.list
# Install dependencies
RUN apt-get update && apt-get install -y \
software-properties-common \
curl \
git
#RUN add-apt-repository universe
RUN apt-get update && apt-get install -y \
curl \
git
RUN apt-get install python3.7
RUN apt-get install python3-pip
# Upgrade pip to 20.x
RUN pip3 install -U pip
COPY ./requirements.txt /requirements.txt
WORKDIR /
RUN pip3 install -r requirements.txt
COPY . /
None of the mentioned solutions I've found so far have been able to fix this issue for me.
I was able to work around this very frustrating issue by setting the apt HTTP proxy to use my internet proxy directly. It is not clear why the invisible proxy works for some packages but not others, but explicitly setting the proxy addressed the issue.
See Cannot install packages with apt-get update in debian (Proxy) [1] for examples of setting the proxy.
I used the /etc/apt/apt.conf.d/30proxy.conf method by creating a file that contained:
Acquire::http { Proxy "http://192.168.0.1:3128" }
where http://192.168.0.1:3128 is the squid proxy.