Docker-compose无法运行apt-get update

tf7tbtn2  于 2023-04-29  发布在  Docker
关注(0)|答案(2)|浏览(237)

我正在尝试通过以下方式构建Docker镜像:

docker-compose up —build

但我得到了错误:

=> ERROR [runtime-image 3/6] RUN apt-get update -y                        1.0s
------                                                                          
 > [runtime-image 3/6] RUN apt-get update -y:                                   
  ……….(successfully updating until here)…….
#0 0.591 Ign:10 http://deb.debian.org/debian stretch/main all Packages
#0 0.591 Err:8 http://security.debian.org/debian-security stretch/updates/main arm64 Packages
#0 0.591   404  Not Found
#0 0.612 Ign:11 http://deb.debian.org/debian stretch-updates/main all Packages
#0 0.632 Ign:12 http://deb.debian.org/debian stretch-updates/main arm64 Packages
#0 0.662 Ign:9 http://deb.debian.org/debian stretch/main arm64 Packages
#0 0.685 Ign:10 http://deb.debian.org/debian stretch/main all Packages
#0 0.707 Ign:11 http://deb.debian.org/debian stretch-updates/main all Packages
#0 0.732 Ign:12 http://deb.debian.org/debian stretch-updates/main arm64 Packages
#0 0.755 Ign:9 http://deb.debian.org/debian stretch/main arm64 Packages
#0 0.777 Ign:10 http://deb.debian.org/debian stretch/main all Packages
#0 0.810 Ign:11 http://deb.debian.org/debian stretch-updates/main all Packages
#0 0.832 Ign:12 http://deb.debian.org/debian stretch-updates/main arm64 Packages
#0 0.854 Err:9 http://deb.debian.org/debian stretch/main arm64 Packages
#0 0.854   404  Not Found
#0 0.923 Ign:10 http://deb.debian.org/debian stretch/main all Packages
#0 0.945 Ign:11 http://deb.debian.org/debian stretch-updates/main all Packages
#0 0.965 Err:12 http://deb.debian.org/debian stretch-updates/main arm64 Packages
#0 0.965   404  Not Found
#0 0.975 Reading package lists...
#0 0.990 W: The repository 'http://security.debian.org/debian-security stretch/updates Release' does not have a Release file.
#0 0.990 W: The repository 'http://deb.debian.org/debian stretch Release' does not have a Release file.
#0 0.990 W: The repository 'http://deb.debian.org/debian stretch-updates Release' does not have a Release file.
#0 0.990 E: Failed to fetch http://security.debian.org/debian-security/dists/stretch/updates/main/binary-arm64/Packages  404  Not Found
#0 0.990 E: Failed to fetch http://deb.debian.org/debian/dists/stretch/main/binary-arm64/Packages  404  Not Found
#0 0.990 E: Failed to fetch http://deb.debian.org/debian/dists/stretch-updates/main/binary-arm64/Packages  404  Not Found
#0 0.990 E: Some index files failed to download. They have been ignored, or old ones used instead.
------
failed to solve: executor failed running [/bin/sh -c apt-get update -y]: exit code: 100

导致错误的docker文件部分是:

….. (successfully building until here) ……..
RUN apt-get update -y
RUN apt-get install -y --no-install-recommends default-libmysqlclient-dev curl apt-utils ffmpeg mysql-server

我在网上尝试了各种推荐的解决方案,但都不起作用。我试着降级Docker版本,但它不起作用。
我正在使用Mac和Docker version is 20.10.24, build 297e128Docker Compose version v2.17.2
任何建议都可以非常赞赏。

bgibtngc

bgibtngc1#

您的映像已过期,并尝试使用不再存在的存储库进行更新,您可以更改构建步骤以在调用update之前首先更新存储库引用,或者将基础映像更新为已经进行此类更新的映像。参见https://unix.stackexchange.com/questions/743839/apt-get-update-failed-to-fetch-debian-amd64-packages-while-building-dockerfile-f

o2gm4chl

o2gm4chl2#

如果你显式地使用debian:stretch作为基础映像,那么我建议你简单地将它升级到debian:bullseye

相关问题