docker-library / openjdk

Docker Official Image packaging for EA builds of OpenJDK from Oracle
http://openjdk.java.net
MIT License
1.14k stars 471 forks source link

In openjdk:11.0.7-jre-slim can not use apt-get update #411

Closed xuecangqiuye closed 4 years ago

xuecangqiuye commented 4 years ago

In openjdk:11.0.7-jre-slim's container can not use apt-get update

I use following cmd:

[root@cm-wsb-c16m64d200-1 ~]# docker pull openjdk:11.0.7-jre-slim
docker run -it docker.io/openjdk bash
[root@cm-wsb-c16m64d200-1 ~]# docker run -it docker.io/openjdk:11.0.7-jre-slim bash
root@e482bece621a:/# apt-get update
Ign:6 http://deb.debian.org/debian buster-updates/main amd64 Packages
Err:5 http://deb.debian.org/debian buster/main amd64 Packages
  Cannot initiate the connection to deb.debian.org:80 (2a04:4e42:36::645). - connect (101: Network is unreachable) Could not connect to deb.debian.org:80 (151.101.230.133), connection timed out [IP: 151.101.230.133 80]
Err:6 http://deb.debian.org/debian buster-updates/main amd64 Packages
  Cannot initiate the connection to deb.debian.org:80 (2a04:4e42:36::645). - connect (101: Network is unreachable) [IP: 151.101.230.133 80]
Fetched 384 kB in 3min 40s (1746 B/s)
Reading package lists... Done
W: Failed to fetch http://deb.debian.org/debian/dists/buster/main/binary-amd64/Packages  Cannot initiate the connection to deb.debian.org:80 (2a04:4e42:36::645). - connect (101: Network is unreachable) Could not connect to deb.debian.org:80 (151.101.230.133), connection timed out [IP: 151.101.230.133 80]
W: Failed to fetch http://deb.debian.org/debian/dists/buster-updates/main/binary-amd64/Packages  Cannot initiate the connection to deb.debian.org:80 (2a04:4e42:36::645). - connect (101: Network is unreachable) [IP: 151.101.230.133 80]
W: Some index files failed to download. They have been ignored, or old ones used instead.

Seems to be a connection problem, so i change /etc/apt/sources.list, and run again:

root@e482bece621a:/# apt-get update
Get:4 http://archive.ubuntu.com/ubuntu focal-backports InRelease [98.3 kB]
Err:4 http://archive.ubuntu.com/ubuntu focal-backports InRelease
  The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 3B4FE6ACC0B21F32 NO_PUBKEY 871920D1991BC93C
Reading package lists... Done
W: GPG error: http://security.ubuntu.com/ubuntu focal-security InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 3B4FE6ACC0B21F32 NO_PUBKEY 871920D1991BC93C
E: The repository 'http://security.ubuntu.com/ubuntu focal-security InRelease' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
....

I google this problem, use apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 3B4FE6ACC0B21F32 can slove this problem.

BUT

root@e482bece621a:/# apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 3B4FE6ACC0B21F32
E: gnupg, gnupg2 and gnupg1 do not seem to be installed, but one of them is required for this operation

I need apt-get install gnupg!!!! This is an endless loop!!! please tell me, how do I use apt-get update after changing the /etc/apt/sources.list???

wglambert commented 4 years ago

I can't reproduce

$ docker pull openjdk:11.0.7-jre-slim
11.0.7-jre-slim: Pulling from library/openjdk
54fec2fa59d0: Pull complete 
b7dd01647a92: Pull complete 
793cbc6f8a59: Pull complete 
50a0e9985dcd: Pull complete 
Digest: sha256:678022f7c59cae7d1afddfc800356611bdedf1030d94cfc503a60a0757d97b79
Status: Downloaded newer image for openjdk:11.0.7-jre-slim
docker.io/library/openjdk:11.0.7-jre-slim

$ docker run -it --rm openjdk:11.0.7-jre-slim bash
root@fe61a362470e:/# apt-get update
Get:1 http://security.debian.org/debian-security buster/updates InRelease [65.4 kB]
Get:2 http://deb.debian.org/debian buster InRelease [121 kB]  
Get:3 http://deb.debian.org/debian buster-updates InRelease [49.3 kB]
Get:4 http://security.debian.org/debian-security buster/updates/main amd64 Packages [197 kB]
Get:5 http://deb.debian.org/debian buster/main amd64 Packages [7905 kB]
Get:6 http://deb.debian.org/debian buster-updates/main amd64 Packages [7380 B]
Fetched 8345 kB in 2s (3956 kB/s)
Reading package lists... Done

Network is unreachable would be an issue on the host's end

You could also try asking over at the Docker Community Forums, Docker Community Slack, or Stack Overflow. Since these repos aren't really a user-help forum