docker build -t my_image
猫 Dockerfile
FROM debian:7.11
COPY sources.list /etc/apt/sources.list
#RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 46925553
ENTRYPOINT [ "tail", "-f", "/dev/null" ]
cat 来源.list
deb [trusted=yes] http://archive.debian.org/debian/ wheezy main contrib non-free
docker run -d my_image
debian$docker exec -ti 15c213123 /bin/sh
#apt-key list
gpg: Segmentation fault caught ... exiting
Segmentation fault
#apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 46925553
Executing: gpg --ignore-time-conflict --no-options --no-default-keyring --secret-keyring /tmp/tmp.HhlRvZl44h --trustdb-name /etc/apt//trustdb.gpg --keyring /etc/apt/trusted.gpg --primary-keyring /etc/apt/trusted.gpg --keyring /etc/apt/trusted.gpg.d//debian-archive-jessie-automatic.gpg --keyring /etc/apt/trusted.gpg.d//debian-archive-jessie-security-automatic.gpg --keyring /etc/apt/trusted.gpg.d//debian-archive-jessie-stable.gpg --keyring /etc/apt/trusted.gpg.d//debian-archive-squeeze-automatic.gpg --keyring /etc/apt/trusted.gpg.d//debian-archive-squeeze-stable.gpg --keyring /etc/apt/trusted.gpg.d//debian-archive-wheezy-automatic.gpg --keyring /etc/apt/trusted.gpg.d//debian-archive-wheezy-stable.gpg --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 46925553
gpg: requesting key 46925553 from hkp server keyserver.ubuntu.com
gpg: unnatural exit of external program
gpg: no handler for keyserver scheme `hkp'
gpg: keyserver receive failed: keyserver error
搞什么?!我的脑子坏了。相同的镜像在 CentOS 上运行良好
centos$ docker exec -ti b9 /bin/sh
#apt-key 列表
...
-----------------------------------------------------------
pub 4096R/46925553 2012-04-27 [revoked: 2019-07-01]
uid Debian Archive Automatic Signing Key (7.0/wheezy) <[email protected]>
/etc/apt/trusted.gpg.d//debian-archive-wheezy-stable.gpg
--------------------------------------------------------
...
debian$docker --version Docker 版本 23.0.2,内部版本 569dd73
centos$ docker --version Docker 版本 20.10.18,构建 b40c2f6
在 centos 上构建的镜像在 debian 上尝试过 在 debian 上构建的镜像在 centos 上尝试过 结果是一样的 在 CentOS 上运行良好,在 Debian 上运行失败