[Docker] apt-get update が 404 エラーで失敗する (stretch)

下記のように、apt-get update が失敗する原因は、サポート終了によるものです。
Debian v.9 の stretch ではエラーとなります。OSイメージを変更できる状態であれば、バージョンを上げることでエラーを回避できます。

5.350 Err:9 http://security.debian.org/debian-security stretch/updates/main arm64 Packages
5.350   404  Not Found [IP: 151.101.2.132 80]
5.477 Ign:12 http://deb.debian.org/debian stretch-updates/main all Packages
5.721 Ign:8 http://deb.debian.org/debian stretch/main all Packages
6.290 Ign:10 http://deb.debian.org/debian stretch/main arm64 Packages
6.960 Ign:11 http://deb.debian.org/debian stretch-updates/main arm64 Packages
7.181 Ign:12 http://deb.debian.org/debian stretch-updates/main all Packages
7.415 Ign:8 http://deb.debian.org/debian stretch/main all Packages
7.892 Ign:10 http://deb.debian.org/debian stretch/main arm64 Packages
8.497 Ign:11 http://deb.debian.org/debian stretch-updates/main arm64 Packages
8.719 Ign:12 http://deb.debian.org/debian stretch-updates/main all Packages
8.941 Ign:8 http://deb.debian.org/debian stretch/main all Packages
9.721 Err:10 http://deb.debian.org/debian stretch/main arm64 Packages
9.721   404  Not Found
10.34 Err:11 http://deb.debian.org/debian stretch-updates/main arm64 Packages
10.34   404  Not Found
10.57 Ign:12 http://deb.debian.org/debian stretch-updates/main all Packages
10.58 Reading package lists...
10.59 W: The repository 'http://security.debian.org/debian-security stretch/updates Release' does not have a Release file.
10.59 W: The repository 'http://deb.debian.org/debian stretch Release' does not have a Release file.
10.59 W: The repository 'http://deb.debian.org/debian stretch-updates Release' does not have a Release file.
10.59 E: Failed to fetch http://security.debian.org/debian-security/dists/stretch/updates/main/binary-arm64/Packages  404  Not Found [IP: 151.101.2.132 80]
10.59 E: Failed to fetch http://deb.debian.org/debian/dists/stretch/main/binary-arm64/Packages  404  Not Found
10.59 E: Failed to fetch http://deb.debian.org/debian/dists/stretch-updates/main/binary-arm64/Packages  404  Not Found
10.59 E: Some index files failed to download. They have been ignored, or old ones used instead.

再現方法は、下記のようなDockerfileを作成し

FROM debian:stretch
RUN apt-get update

イメージを作成してみます

docker build -t stretch:1 .

エラーが発生します

Dockerfile:2
--------------------
   1 |     FROM debian:stretch
   2 | >>> RUN apt-get update
   3 |
   4 |
--------------------
ERROR: failed to solve: process "/bin/sh -c apt-get update" did not complete successfully: exit code: 100

DockerDebian,Docker

Posted by kidatti