如何在 alpine linux 中安装 zless?

How to install zless in alpine linux?

我是 运行 一个来自 alpine-linux 图像的 docker 容器。它包含 zcat 但不包含 zlesszgrep。如何安装到容器中?

假设有一个新图像,更新包索引:

apk update

然后添加gzip包,包含zlesszgrep等:

apk add gzip

在此处查看包装内容:https://pkgs.alpinelinux.org/contents?branch=v3.5&name=gzip&arch=aarch64&repo=main

如果您想知道为什么包含 zcat 而不是其他工具,即使 zcatgzip 包中,它也包含在另一个包中:

/ # apk info --who-owns $(which zcat)
/bin/zcat symlink target is owned by busybox-1.25.1-r0