我正在构建一个基于 UBI8(Red Hat Universal Base Image)的 docker 镜像,Dockerfile 看起来像
FROM registry.access.redhat.com/ubi8/ubi-minimal
RUN microdnf install sudo zip tar bash procps openssl iptables net-tools tcpdump && microdnf update; microdnf clean all
ENTRYPOINT [ "/usr/sbin/tcpdump" ]
但未能安装 tcpdump 包。
Downloading metadata...
error: No package matches 'tcpdump'
(process:57): librhsm-WARNING **: 22:03:51.398: Found 0 entitlement certificates
(process:57): librhsm-WARNING **: 22:03:51.400: Found 0 entitlement certificates
(process:57): libdnf-WARNING **: 22:03:51.400: Loading "/etc/dnf/dnf.conf": IniParser: Can't open file
如何修复它以便在 UBI 中安装 tcpdump 包?谢谢。
答案1
就我而言,我正在创建基于 ubi8-minimal 的自定义版本的图像(https://hub.docker.com/r/jboss/keycloak),所以我无法更改基本图像。支持工具图像不公开 - 需要注册。我最终手动安装:
curl http://mirror.centos.org/centos/8-stream/AppStream/x86_64/os/Packages/tcpdump-4.9.3-1.el8.x86_64.rpm -o tcpdump-4.9.3-1.el8.x86_64.rpm
microdnf install shadow-utils
microdnf install libpcap-14:1.9.1-5.el8.x86_64
rpm -i tcpdump-4.9.3-1.el8.x86_64.rpm
答案2
您可以使用registry.redhat.io/rhel8/support-tools作为基础镜像。它附带 tcpdump-4.9.2-6.el8 以及其他故障排除工具。
http://ftp.redhat.com/pub/redhat/containers/rhel8/support-tools/8.2-19.txt
例如
oc import-image rhel8/support-tools --from=registry.redhat.io/rhel8/support-tools --confirm