Alpine linux:将 BusyBox tail 替换为 GNU tail

Alpine linux:将 BusyBox tail 替换为 GNU tail

我需要tail ... --pid=PID在 docker 容器中使用基于Alpine图像的选项,以便可以自动终止正在运行的后台 tail 进程。

不幸的是,BusyBox tailAlpine Docker 镜像中提供的镜像不支持此功能。

我试图找到一种材料来描述如何更换它的过程,但没有成功。

我不想使用另一个基本图像,因为图像大小很重要。

是否有可能以某种方式切换到 GNU tail?

答案1

这是解决方案:

apk add --no-cache bash coreutils

前:

tail --version
tail: unrecognized option: version
BusyBox v1.35.0 (2022-11-19 10:13:10 UTC) multi-call binary.

后:

tail --version
tail (GNU coreutils) 9.1
Copyright (C) 2022 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

相关内容