Docker容器-安装

本文内容主要记录Docker安装

卸载旧版本

1
2
3
4
5
6
7
8
9
10
sudo yum remove -y docker \
docker-client \
docker-client-latest \
docker-common \
docker-latest \
docker-latest-logrotate \
docker-logrotate \
docker-selinux \
docker-engine-selinux \
docker-engine

设置 yum repository

1
2
3
4
5
6
sudo yum install -y yum-utils \
device-mapper-persistent-data \
lvm2
sudo yum-config-manager \
--add-repo \
https://download.docker.com/linux/centos/docker-ce.repo

安装并启动 docker

1
2
3
sudo yum install -y docker-ce-18.09.7 docker-ce-cli-18.09.7 containerd.io
sudo systemctl enable docker
sudo systemctl start docker

设置docker源

1
2
3
4
vi /etc/docker/daemon.json
{
"registry-mirrors": ["https://h64mkioy.mirror.aliyuncs.com"]
}

修改docker路径

1
2
3
4
vi /usr/lib/systemd/system/docker.service
ExecStart=/usr/bin/dockerd 后面加上 --graph /data/docker
systemctl daemon-reload
systemctl restart docker
-->