amd64/busybox Docker 镜像
Busybox基础镜像集成多种Unix工具,提供轻量级运行环境,适用于构建精简的Docker应用镜像。
BusyBox Docker镜像文档
镜像概述
amd64/busybox是https://hub.docker.com/_/busybox的`amd64`架构专用仓库。BusyBox被誉为"嵌入式Linux的瑞士军刀",是一个集成了多种常见UNIX工具的小型可执行文件,磁盘大小通常在1-5MB之间(取决于变体),非常适合构建空间高效的容器发行版。
注意:有关非amd64架构的信息,参见https://github.com/docker-library/official-images#architectures-other-than-amd64;有关镜像源码变更的说明,参见https://github.com/docker-library/faq#an-images-source-changed-in-git-now-what。
核心功能与特性
核心功能
- 多工具集成:将数十种常见UNIX工具(如
ls、cp、sh、grep等)整合为单个小型可执行文件 - 功能兼容:提供与GNU工具集基本兼容的命令选项,确保常用功能正常工作
- 轻量级设计:极小的磁盘占用(1-5MB)和内存 footprint,适合资源受限环境
主要特性
- 多libc支持:提供glibc、uClibc、musl三种libc变体,适应不同场景需求
- 跨架构兼容:支持多种硬件架构(amd64、arm32v5/v6/v7、arm64v8等)
- 静态编译选项:部分变体(uClibc、musl)采用静态编译,减少运行时依赖
- 版本化标签:提供稳定版(stable)和不稳定版(unstable)标签,满足不同稳定性需求
支持的标签及Dockerfile链接
| 标签 | Dockerfile链接 |
|---|---|
1.37.0-glibc, 1.37-glibc, 1-glibc, unstable-glibc, glibc | https://github.com/docker-library/busybox/blob/e5b5178110ca0332364a77d5eb4fff87b0e2ba3f/latest/glibc/amd64/index.json |
1.37.0-uclibc, 1.37-uclibc, 1-uclibc, unstable-uclibc, uclibc | https://github.com/docker-library/busybox/blob/e5b5178110ca0332364a77d5eb4fff87b0e2ba3f/latest/uclibc/amd64/index.json |
1.37.0-musl, 1.37-musl, 1-musl, unstable-musl, musl | https://github.com/docker-library/busybox/blob/e5b5178110ca0332364a77d5eb4fff87b0e2ba3f/latest/musl/amd64/index.json |
1.37.0, 1.37, 1, unstable, latest | https://github.com/docker-library/busybox/blob/e5b5178110ca0332364a77d5eb4fff87b0e2ba3f/latest/glibc/amd64/index.json |
1.36.1-glibc, 1.36-glibc, stable-glibc | https://github.com/docker-library/busybox/blob/e5b5178110ca0332364a77d5eb4fff87b0e2ba3f/latest-1/glibc/amd64/index.json |
1.36.1-uclibc, 1.36-uclibc, stable-uclibc | https://github.com/docker-library/busybox/blob/e5b5178110ca0332364a77d5eb4fff87b0e2ba3f/latest-1/uclibc/amd64/index.json |
1.36.1-musl, 1.36-musl, stable-musl | https://github.com/docker-library/busybox/blob/e5b5178110ca0332364a77d5eb4fff87b0e2ba3f/latest-1/musl/amd64/index.json |
1.36.1, 1.36, stable | https://github.com/docker-library/busybox/blob/e5b5178110ca0332364a77d5eb4fff87b0e2ba3f/latest-1/glibc/amd64/index.json |
使用场景
- 嵌入式系统开发:作为轻量级基础环境,提供核心工具链
- 资源受限环境:在低内存、小磁盘空间的设备中运行基础命令
- 轻量级容器基础:作为静态编译应用的基础镜像,减小最终镜像体积
- 临时调试环境:快速启动包含基础工具的容器,用于系统调试
- CI/CD流水线:在构建流程中作为轻量级执行环境,减少资源消耗
使用方法
运行BusyBox Shell
通过以下命令启动交互式BusyBox shell:
console$ docker run -it --rm amd64/busybox
此命令会启动一个临时容器并进入sh shell,退出后容器自动删除(--rm参数)。
创建静态二进制基础镜像
对于静态编译的应用,可使用BusyBox作为基础镜像构建极小镜像。创建Dockerfile如下:
dockerfileFROM docker.xuanyuan.run/amd64/busybox COPY ./my-static-binary /my-static-binary CMD ["/my-static-binary"]
说明:需确保my-static-binary是静态编译的(无动态依赖),可通过ldd my-static-binary验证(输出"not a dynamic executable"表示静态编译)。
镜像变体
amd64/busybox提供三种libc变体,适应不同兼容性和大小需求:
amd64/busybox:glibc
- libc来源:Debian的https://packages.debian.org/search?searchon=names&exact=1&suite=all§ion=all&keywords=libc6(动态链接)
- 特点:兼容性最好,支持更多动态链接应用,但体积相对较大
- 适用场景:需要广泛兼容性的动态链接应用
amd64/busybox:uclibc
- libc来源:通过Buildroot构建的https://uclibc.org(静态编译)
- 特点:体积小于glibc变体,专为嵌入式系统优化
- 适用场景:嵌入式设备、对体积敏感的静态应用
amd64/busybox:musl
- libc来源:Alpine的https://pkgs.alpinelinux.org/packages?name=musl(静态编译)
- 特点:体积最小,严格遵循POSIX标准,安全性高
- 适用场景:极简容器、安全敏感的静态应用
维护与支持
维护者
https://github.com/docker-library/busybox
获取帮助
- https://dockr.ly/comm-slack
- Server Fault
- https://unix.stackexchange.com/help/on-topic
- https://stackoverflow.com/help/on-topic
提交Issue
https://github.com/docker-library/busybox/issues?q=
支持的架构
amd64、arm32v5、arm32v6、arm32v7、arm64v8、i386、ppc64le、riscv64、s390x
(https://github.com/docker-library/official-images#architectures-other-than-amd64)
镜像元数据
- https://github.com/docker-library/repo-info/blob/master/repos/busybox(包含镜像元数据、传输大小等)
镜像更新
- https://github.com/docker-library/official-images/issues?q=label%3Alibrary%2Fbusybox
- https://github.com/docker-library/official-images/blob/master/library/busybox(更新历史)
许可证
软件许可证
BusyBox的许可证信息参见http://www.busybox.net/license.html。
镜像包含软件
与所有Docker镜像一样,本镜像可能包含其他软件(如基础发行版的Bash等),这些软件可能具有独立许可证。
额外许可证信息
自动检测的许可证信息可在https://github.com/docker-library/repo-info/tree/master/repos/busybox中找到。
使用责任:镜像用户需自行确保其使用符合所有包含软件的相关许可证要求。
amd64 命名空间的其他可用镜像:
镜像拉取方式
您可以使用以下命令拉取该镜像。请将 <标签> 替换为具体的标签版本。如需查看所有可用标签版本,请访问 标签列表页面。
DockerHub 原生拉取命令
用户好评
来自真实用户的反馈,见证轩辕镜像的优质服务