1.基础命令
curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
yum install epel-release -y
yum list docker --show-duplicates
yum install yum-utils -y
2.安装docker
yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
yum list docker-ce --show-duplicates
yum install docker-ce -y
systemctl enable docker #设置docker自启动
systemctl start docker #启动docker
3.docker配置
vim /etc/docker/daemon.json
{
"graph": "/data/docker", #docker工作目录
"storage-driver": "overlay2", #存储驱动为overlay2
"insecure-registries": ["registry.access.redhat.com","quay.io"],
"registry-mirrors": ["https://q2gr04ke.mirror.aliyuncs.com"], #阿里云镜像
"bip": "172.7.4.1/24", #7.3和宿主机的10.4.7.3后俩位相同,容器出现错误能很快找到宿主机
"exec-opts": ["native.cgroupdriver=systemd"],
"live-restore": true #不依赖于docker引擎,引擎挂掉,不影响容器的运行
}
网友评论