我正在尝试在 Debian 9.8 上设置 docker 容器,但运行时不断收到以下错误docker-compose up -d
:
W: Failed to fetch http://deb.debian.org/debian/dists/jessie-updates/main/binary-amd64/Packages 404 Not Found
这会导致该过程被缩短。
我有以下 Dockerfile(为了便于阅读而缩短),其中有 2 个调用,apt-get update
我已根据建议进行了修改从 这些 页面无济于事:
FROM python:3.5.2
RUN echo "deb [check-valid-until=no] http://archive.debian.org/debian jessie main" > /etc/apt/sources.list.d/jessie.list
RUN sed -i '/deb http:\/\/deb.debian.org\/debian jessie-updates main/d' /etc/apt/sources.list
RUN apt-get -o Acquire::Check-Valid-Until=false update
RUN sed -i '/jessie-updates/d' /etc/apt/sources.list
RUN apt-get update
RUN apt-get install -y git
[...]
RUN apt-get install -y xvfb
RUN pip install algoliasearch==1.12.0
[...]
RUN pip install gunicorn
RUN echo "deb [check-valid-until=no] http://archive.debian.org/debian jessie main" > /etc/apt/sources.list.d/jessie.list
RUN sed -i '/deb http:\/\/deb.debian.org\/debian jessie-updates main/d' /etc/apt/sources.list
RUN apt-get -o Acquire::Check-Valid-Until=false update
RUN sed -i '/jessie-updates/d' /etc/apt/sources.list
RUN apt-get update
RUN wget https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-2.1.1-linux-x86_64.tar.bz2
[...]
RUN export PATH="$(pwd)":$PATH
WORKDIR /usr/src/api
CMD sh -c "gunicorn sourcingplatform.wsgi:application --bind 0.0.0.0:80"
我还删除了我能在 中找到的任何对 jessie 的引用/etc/apt/sources/list
。我缺少什么?
答案1
我怀疑这里的第一行不匹配,所以你仍在尝试获取jessie-updates
:
RUN sed -i '/deb http:\/\/deb.debian.org\/debian jessie-updates main/d' /etc/apt/sources.list
RUN apt-get -o Acquire::Check-Valid-Until=false update
sed
使用您已有的更通用的命令:
RUN sed -i '/jessie-updates/d' /etc/apt/sources.list
RUN apt-get -o Acquire::Check-Valid-Until=false update