CentOS7安装docker-ce,附脚本一键部署

CentOS7 使用yum命令安装docker

安装依赖包

yum -y install yum-utils device-mapper-persistent-data lvm2

设置阿里云镜像源,同样也可以根据需求设置其他的镜像源

yum-config-manager --add-repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo

安装docker-ce

yum install -y docker-ce

接下来就可以直接启动docker

systemctl start docker
systemctl enable docker

查看docker运行状态

systemctl status docker
ps aux|grep docker

使用脚本一键部署

#!/bin/bash
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo 
yum makecache
yum clean all
yum -y install yum-utils device-mapper-persistent-data lvm2
yum-config-manager --add-repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
yum install -y docker-ce
# 防火墙根据实际需求决定是否关闭
#systemctl stop firewalld
#systemctl disable firewalld
#setenforce 0
systemctl enable docker
systemctl start docker

你可能感兴趣的:(docker)