Código
[root@all-in-one ~]# yum install python-devel libffi-devel gcc openssl-devel libselinux-python -y
# 设置docker仓库文件:
[root@all-in-one ~]# yum install yum-utils lvm2 device-mapper-persistent-data -y
[root@all-in-one ~]# yum-config-manager --add-repo \
https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
[root@all-in-one ~]# yum repolist
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.bfsu.edu.cn
* epel: mirrors.bfsu.edu.cn
* extras: mirrors.bfsu.edu.cn
* updates: mirrors.nju.edu.cn
源标识 源名称 状态
base/7/x86_64 CentOS-7 - Base 10,070
docker-ce-stable/x86_64 Docker CE Stable - x86_64 73
epel/x86_64 Extra Packages for Enterprise Linux 7 - x86_64 13,281
extras/7/x86_64 CentOS-7 - Extras 397
updates/7/x86_64 CentOS-7 - Updates 671
repolist: 24,492
# 安装Docker服务
[root@all-in-one ~]# yum install docker-ce docker-ce-cli containerd.io -y
# 开启dokcer服务
[root@all-in-one ~]# systemctl enable docker.service
[root@all-in-one ~]# systemctl start docker.service
[root@all-in-one ~]# tee /etc/docker/daemon.json <<-'EOF'
> {
> "registry-mirrors": ["https://7bc3o1s2.mirror.aliyuncs.com"]
> }
> EOF
{
"registry-mirrors": ["https://7bc3o1s2.mirror.aliyuncs.com"]
}
[root@all-in-one ~]# systemctl restart docker.service
O usa el guión oficial
Por supuesto, en el entorno de prueba o desarrollo, Docker
para simplificar el proceso de instalación, el funcionario proporciona un conjunto de scripts de instalación convenientes, CentOS
que se pueden instalar en el sistema:
curl -fsSL get.docker.com -o get-docker.sh
sh get-docker.sh
docker-install
Guiones específicos a los que puede hacer referencia :
https://github.com/docker/docker-install