busybox是一個軟件工具箱,里邊集成了linux中幾百個常用的linux命令以及工具。大小只有1.2M,適合用來測試用。
1.安裝並設置阿里鏡像源
2.下載並運行busybox
[root@localhost container]# docker images REPOSITORY TAG IMAGE ID CREATED SIZE [root@localhost container]# docker search busybox INDEX NAME DESCRIPTION STARS OFFICIAL AUTOMATED docker.io docker.io/busybox Busybox base image. 1969 [OK] docker.io docker.io/progrium/busybox 71 [OK] docker.io docker.io/radial/busyboxplus Full-chain, Internet enabled, busybox made... 32 [OK] docker.io docker.io/yauritux/busybox-curl Busybox with CURL 10 docker.io docker.io/arm32v7/busybox Busybox base image. 8 docker.io docker.io/armhf/busybox Busybox base image. 6 docker.io docker.io/odise/busybox-curl 4 [OK] docker.io docker.io/arm64v8/busybox Busybox base image. 3 docker.io docker.io/aarch64/busybox Busybox base image. 2 docker.io docker.io/arm32v6/busybox Busybox base image. 2 docker.io docker.io/i386/busybox Busybox base image. 2 docker.io docker.io/joeshaw/busybox-nonroot Busybox container with non-root user nobody 2 docker.io docker.io/p7ppc64/busybox Busybox base image for ppc64. 2 docker.io docker.io/prom/busybox Prometheus Busybox Docker base images 2 [OK] docker.io docker.io/s390x/busybox Busybox base image. 2 docker.io docker.io/ppc64le/busybox Busybox base image. 1 docker.io docker.io/spotify/busybox Spotify fork of https://hub.docker.com/_/b... 1 docker.io docker.io/vukomir/busybox busybox and curl 1 docker.io docker.io/amd64/busybox Busybox base image. 0 docker.io docker.io/arm32v5/busybox Busybox base image. 0 docker.io docker.io/concourse/busyboxplus 0 docker.io docker.io/e2eteam/busybox 0 docker.io docker.io/emccorp/busybox Busybox 0 docker.io docker.io/ggtools/busybox-ubuntu Busybox ubuntu version with extra goodies 0 [OK] docker.io docker.io/sou856099/busybox 0 [root@localhost container]# docker pull busybox Using default tag: latest Trying to pull repository docker.io/library/busybox ... latest: Pulling from docker.io/library/busybox 61c5ed1cbdf8: Pull complete Digest: sha256:4f47c01fa91355af2865ac10fef5bf6ec9c7f42ad2321377c21e844427972977 Status: Downloaded newer image for docker.io/busybox:latest [root@localhost container]# docker images REPOSITORY TAG IMAGE ID CREATED SIZE docker.io/busybox latest 018c9d7b792b 2 weeks ago 1.22 MB
運行
[root@localhost container]# docker run -it --cpu-period=100000 --cpu-quota=20000 --name my-busybox1 docker.io/busybox /bin/sh / # top Mem: 841296K used, 136508K free, 18500K shrd, 0K buff, 151804K cached CPU: 0.0% usr 10.0% sys 0.0% nic 90.0% idle 0.0% io 0.0% irq 0.0% sirq Load average: 0.00 0.00 0.02 2/365 6 PID PPID USER STAT VSZ %VSZ CPU %CPU COMMAND 1 0 root S 1308 0.1 0 0.0 /bin/sh 6 1 root R 1304 0.1 0 0.0 top / # ps -ef PID USER TIME COMMAND 1 root 0:00 /bin/sh 7 root 0:00 ps -ef / #
3.操作系統下載
很多時候我們可能需要安裝一些虛擬系統包括里邊配置一些環境,那么就需要下載一些操作系統鏡像,比如ubuntu 、centos等等。
我們可以通過docker search osname來查看鏡像。比如:
docker search centos
docker search ubuntu
等等,下載需要的鏡像。根據鏡像創建容器以后即可正常使用,也可以操作以后再次進行封裝形成一個新的鏡像模板。
說明:
(1)官方的鏡像一般都比較小,只安裝常用組件,具有通用性,可塑性更好。個人建議下載這種鏡像后進行配置優化。
(2)一些個人或組織上傳的鏡像內容比較豐富,適合測試侍弄,但未必適合自己的生產環境。