Busybox 在 Docker 中的部署和启动

可以使用 docker pull 指令下载 busybox:latest 镜像:

PS C:\Users\yhu> docker pull busybox:latest
latest: Pulling from library/busybox
ec562eabd705: Pull complete
Digest: sha256:5eef5ed34e1e1ff0a4ae850395cbf665c4de6b4b83a32a0bc7bcb998e24e7bbb
Status: Downloaded newer image for busybox:latest
docker.io/library/busybox:latest

What's Next?
  View a summary of image vulnerabilities and recommendations → docker scout quickview busybox:latest
PS C:\Users\yhu>

下载后,可以看到 busybox 镜像只有 4.26 MB

PS C:\Users\yhu> docker image ls
REPOSITORY                                        TAG               IMAGE ID       CREATED         SIZE
repo-docker.isharkfly.com/docker-hub/visatrack    latest            a329341dbaeb   3 days ago      522MB
repo-docker.isharkfly.com/docker-hub/visatrack    <none>            f5f9d8b3b410   3 days ago      522MB
alpine/git                                        latest            80ed206c002b   7 days ago      50.4MB
data-mq-service                                   0.0.1-SNAPSHOT    7eb277a365d6   3 weeks ago     475MB
docsify-docs                                      0.0.1             32062033284a   6 weeks ago     1.13GB
<none>                                            <none>            0ebfbefe1d52   6 weeks ago     1.13GB
alpine                                            latest            05455a08881e   3 months ago    7.38MB
zchub-crawler                                     latest            b20aa408fe8f   7 months ago    1.6GB
mq-service                                        0.0.1-SNAPSHOT    308dd50eb67a   7 months ago    441MB
reso-web-api-reference-server-odata-manager-app   latest            27cdaae03879   8 months ago    441MB
reso-builder                                      latest            cabba9a35a22   8 months ago    1.47GB
busybox                                           latest            65ad0d468eb1   11 months ago   4.26MB
tutor-service                                     0.0.1-SNAPSHOT    20d2f52a1fc4   13 months ago   521MB
sharkfly-wechat-service                           0.0.1-SNAPSHOT    0d3e7843994e   13 months ago   465MB
eclipse-temurin                                   17-jdk-alpine     9a0a4e74d117   13 months ago   358MB
rabbitmq                                          3.11-management   04a3a28a368b   13 months ago   255MB
framework-spring-docker                           0.0.1-SNAPSHOT    42e51829e8c7   15 months ago   379MB
adoptopenjdk/openjdk11-openj9                     alpine            b533cd6150ba   15 months ago   379MB
mysql/mysql-server                                latest            1d9c2219ff69   16 months ago   496MB
docker101tutorial                                 latest            e60bd4e10534   17 months ago   47MB
alpine/git                                        <none>            22d84a66cda4   17 months ago   43.6MB
PS C:\Users\yhu>

如果只说是大小来说,Alpine 也大不了多少,但 Alpine 提供了更多的功能。

这也就是为什么 Docker 官方切换到 Alpine 的原因。