使用 Docker,?只需要一个命令就能快速获取一个 Linux?发行版镜像,这是以往各种虚拟化技术都难以实现的。这些镜像一般都很精简,但是可以支持完整 Linux?系统的大部分功能。
BusyBox
BusyBox 是一个集成了一百多个最常见 Linux 命令(如 cat、echo、grep、mount、telnet等)的精简工具箱,它只有不到 2 MB大小,被誉为"Linux" 系统的瑞士军刀。
docker search busybox
docker pull busybox:latest
docker run -it busybox
docker run --name busybox -P -itd busybox:latest sh
docker exec -it busybox sh
Alpine
Alpine 操作系统是一个面向安全的轻型 Linux 发行版,关注安全、性能和资源效能。
docker search alpine
docker pull alpine:latest
docker run --name alpine -P -itd alpine:latest sh
docker exec -it alpine sh
Debian
Debian 是基于 GPL 授权的开源操作系统,是目前个人电脑与服务器中最受欢迎的开源操作系统之一,由 Debian 计划(Debian Project)组织维护。
docker search debian
docker pull debian:latest
docker run --name debian -P -itd debian:latest bash
docker exec -it debian bash
apt update
apt-get install nginx
service nginx start
Ubuntu
docker search --filter=stars=50 ubuntu
docker pull ubuntu:18.04
docker run --name ubuntu -P -itd ubuntu:18.04 bash
docker exec -it ubuntu bash
apt update
apt-get install nginx
service nginx start
Centos
docker search --filter=stars=50 centos
docker pull centos:7
docker run --name centos -P -itd centos:7 bash
docker exec -it centos bash
rpm -Uvh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm
yum install -y nginx
systemctl enable nginx.service
cd /sbin;service nginx restart;ps -ef|grep nginx
Fedora
docker search --filter=stars=50 fedora
docker pull fedora:latest
docker run --name fedora -P -itd fedora:latest bash
docker exec -it fedora bash
rpm -Uvh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm
yum install -y nginx
systemctl enable nginx.service
cd /sbin;service nginx restart;ps -ef|grep nginx
|