使用Docker删除软件包后如何安装debian jessie-backports软件包?

时间:2019-05-08 00:44:29

标签: docker docker-compose debian

问题

我正尝试在使用此Dockerfile的Ruby on Rails项目的docker存储库中使用jessie-backports:

FROM ruby:2.4.1
ENV DEBIAN_FRONTEND noninteractive
ENV DEBCONF_NONINTERACTIVE_SEEN true

RUN echo 'alias ll="ls --color=auto -l"' >> ~/.bashrc
RUN apt-get remove -y python
RUN apt-get update --fix-missing
RUN apt-get -y upgrade

RUN echo "deb http://ftp.debian.org/debian jessie-backports main" >> /etc/apt/sources.list && apt-get update
RUN apt-get install -y certbot -t jessie-backports

但是,当我尝试构建docker镜像时。安装过程中出现以下错误:

E: Release file for http://archive.debian.org/debian/dists/jessie-backports/InRelease is expired (invalid since 77d 3h 49min 17s). Updates for this repository will not be applied.

截至3月27日, Lucas Nussbaum 在此blogpost中写道,将要从Debian镜像中删除jessie-updates和jessie-backports。 我提到的博客文章指出,我需要做的是替换:

deb http://ftp.debian.org/debian jessie-backports main

使用其他命令:

deb http://archive.debian.org/debian/ jessie-backports main contrib non-free
echo 'Acquire::Check-Valid-Until no;' > /etc/apt/apt.conf.d/99no-check-valid-until

所以我将命令更改如下:

FROM ruby:2.4.1
ENV DEBIAN_FRONTEND noninteractive
ENV DEBCONF_NONINTERACTIVE_SEEN true

RUN echo 'alias ll="ls --color=auto -l"' >> ~/.bashrc
RUN apt-get remove -y python
RUN apt-get update --fix-missing
RUN apt-get -y upgrade

RUN echo "deb http://archive.debian.org/debian/ jessie-backports main contrib non-free" > /etc/apt/sources.list
RUN echo 'Acquire::Check-Valid-Until no;' > /etc/apt/apt.conf.d/99no-check-valid-until
RUN apt-get update

但是仍然存在相同的问题。

我还试图将命令移到任何 apt 命令之前,如下所示:

FROM ruby:2.4.1
ENV DEBIAN_FRONTEND noninteractive
ENV DEBCONF_NONINTERACTIVE_SEEN true

RUN echo 'alias ll="ls --color=auto -l"' >> ~/.bashrc

RUN echo "deb http://archive.debian.org/debian/ jessie-backports main contrib non-free" > /etc/apt/sources.list
RUN echo 'Acquire::Check-Valid-Until no;' > /etc/apt/apt.conf.d/99no-check-valid-until
RUN apt-get update

RUN apt-get remove -y python
RUN apt-get update --fix-missing
RUN apt-get -y upgrade

0 个答案:

没有答案