簡體   English   中英

每次我嘗試構建我的 Docker Ubuntu 16:04 圖像時出現錯誤請求 (400) 消息

[英]Bad Request (400) message every time I try to build my Docker Ubuntu 16:04 image

我正在嘗試使用 requirements.txt 中指定的requirements.txt構建 docker 映像。 但是,在嘗試構建文件時,我收到以下錯誤:

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]

我試圖更改鏡像,我檢查了 cat /etc/apt/sources.list 的 output,我嘗試添加標志--fix-missing並嘗試使用--no-cache all 構建映像徒勞無功。

這是 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 . /

到目前為止,我發現的上述解決方案都無法為我解決此問題。

我在這里找到了一個對我有幫助的解決方案: https://www.kubuntuforums.net/showthread.php?57567-Ubuntu-problems-on-update

您可以讓 apt-get 使用以下命令重新生成列表緩存:

sudo apt-get clean
cd /var/lib/apt
sudo mv lists lists.old
sudo mkdir -p lists/partial
sudo apt-get clean
sudo apt-get update

我遇到了同樣的錯誤。 這是自找的。

我已經設置了我的終端來攔截(和代理)所有網絡流量。 關閉該環境變量修復了 Docker 構建:

unset https_proxy

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM