所以我现在很纠结,我创建了一个 dockerfile,并在该 dockerfile 中运行 apt-get update,但这里不起作用,因为底层基础发行版 debian:stretch 不再位于主镜像中。所以我主要使用我从研究中添加的内容让它工作,但我还没有设法让它完全正确。
有人知道我该如何修复这里出现的最后几个错误吗?更新到 PHP 7.4 不是一个选项,而且我不能使用除 debian:stretch 之外的其他底层基础发行版,除非有预制的 docker 镜像。
FROM php:5.6-apache as dev
ENV DEBIAN_FRONTEND=noninteractive
ENV APP_ENV=development
ADD https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions /usr/local/bin/
COPY ../. /var/www/xx
RUN chmod +x /usr/local/bin/install-php-extensions
#from research
RUN echo "deb [trusted=yes] http://archive.debian.org/debian/ stretch main" >> /etc/apt/sources.list
RUN echo "deb-src [trusted=yes] http://archive.debian.org/debian/ stretch main" >> /etc/apt/sources.list
RUN echo "deb [trusted=yes] http://archive.debian.org/debian/ stretch-backports main" >> /etc/apt/sources.list
RUN echo "deb [trusted=yes] http://archive.debian.org/debian-security/ stretch/updates main" >> /etc/apt/sources.list
RUN echo "deb-src [trusted=yes] http://archive.debian.org/debian-security/ stretch/updates main" >> /etc/apt/sources.list
#end from research
RUN apt-get update
RUN apt-get -y install --no-install-recommends apt-utils zip unzip nano ncdu git vim gitg ssh 2>&1
RUN install-php-extensions intl pdo_mysql opcache gd gettext json calendar curl apcu zip
RUN echo "memory_limit = 512M" >> /usr/local/etc/php/php.ini
RUN echo "max_execution_time = 600" >> /usr/local/etc/php/php.ini
RUN echo "date.timezone=Europe/Zurich" >> /usr/local/etc/php/php.ini
RUN a2enmod rewrite
RUN apt-get autoremove -y
RUN apt-get clean -y
RUN rm -rf /var/lib/apt/lists/*
RUN rm -rf /etc/apache2/sites-enabled
RUN ln -s /var/www/xx/.devcontainer/sites-enabled /etc/apache2/sites-enabled
ENV DEBIAN_FRONTEND=dialog
#0 3.467 W: The repository 'http://security.debian.org/debian-security stretch/updates Release' does not have a Release file.
#0 3.467 W: The repository 'http://deb.debian.org/debian stretch Release' does not have a Release file.
#0 3.467 W: The repository 'http://deb.debian.org/debian stretch-updates Release' does not have a Release file.
#0 3.467 W: GPG error: http://archive.debian.org/debian stretch-backports InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 648ACFD622F3D138 NO_PUBKEY 0E98404D386FA1D9
#0 3.467 E: Failed to fetch http://security.debian.org/debian-security/dists/stretch/updates/main/binary-amd64/Packages 404 Not Found [IP: 151.101.2.132 80]
#0 3.467 E: Failed to fetch http://deb.debian.org/debian/dists/stretch/main/binary-amd64/Packages 404 Not Found
#0 3.467 E: Failed to fetch http://deb.debian.org/debian/dists/stretch-updates/main/binary-amd64/Packages 404 Not Found
#0 3.467 E: Some index files failed to download. They have been ignored, or old ones used instead.
答案1
只有你添加新的档案 URL,但并未删除旧的。
在附加新行之前添加true > sources.list
或。rm -f sources.list