「BusyBox」- The Swiss Army Knife of Embedded Linux

认识

官网:https://busybox.net/
文档:https://busybox.net/downloads/BusyBox.html
仓库:https://busybox.net/source.html

BusyBox combines tiny versions of many common UNIX utilities into a single small executable. It provides replacements for most of the utilities you usually find in GNU fileutils, shellutils, etc. The utilities in BusyBox generally have fewer options than their full-featured GNU cousins; however, the options that are included provide the expected functionality and behave very much like their GNU counterparts. BusyBox provides a fairly complete environment for any small or embedded system. 简而言之,BusyBox 将常用的 GNU Linux 工具(部分功能)集成到单个程序文件中,以降低资源消耗,进而应用于小型或嵌入式系统中。

组成

WIP

性质

高度集成:包含 300 多个常用命令(如 ls, cp, mv, grep, find 等)

  • 文本编辑 | 使用 vi 命令

体积小巧:相比完整的 GNU 工具集,体积显著减小
模块化设计:可以只包含需要的工具,进一步减小体积
高度可配置:可以根据需要裁剪功能
开源:遵循 GPL 许可证

构建

程序文件:https://busybox.net/downloads/binaries/

静态链接:https://busybox.net/downloads/binaries/1.35.0-x86_64-linux-musl/busybox

容器镜像

[I] SRC: docker.io/library/busybox:1.37.0
[I] DST: ccr.ccs.tencentyun.com/d3rm-3rd/docker.io_library_busybox:1.37.0

针对我们的场景,我们更多使用其 Docker 镜像 | https://hub.docker.com/_/busybox

kubectl create deployment busybox \
    --image=ccr.ccs.tencentyun.com/d3rm-3rd/docker.io_library_busybox:1.37.0 \
    --replicas=1 -- sleep infinity

场景

容器基础镜像;在 Kubernetes 中,用 BusyBox 提供的工具来执行测试或排错任务;
嵌入式 Linux 系统
救援/恢复环境
路由器等网络设备
小型 Linux 发行版