![同一 docker 镜像中的命令在 CentOS 8 上工作,但在 Debian 11 上因段错误而失败](https://linux22.com/image/218611/%E5%90%8C%E4%B8%80%20docker%20%E9%95%9C%E5%83%8F%E4%B8%AD%E7%9A%84%E5%91%BD%E4%BB%A4%E5%9C%A8%20CentOS%208%20%E4%B8%8A%E5%B7%A5%E4%BD%9C%EF%BC%8C%E4%BD%86%E5%9C%A8%20Debian%2011%20%E4%B8%8A%E5%9B%A0%E6%AE%B5%E9%94%99%E8%AF%AF%E8%80%8C%E5%A4%B1%E8%B4%A5.png)
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 上运行失败