docker安装

docker安装

安装

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
yum remove docker \
docker-client \
docker-client-latest \
docker-common \
docker-latest \
docker-latest-logrotate \
docker-logrotate \
docker-engine
yum install -y yum-utils \
device-mapper-persistent-data \
lvm2
yum-config-manager \
--add-repo \
https://download.docker.com/linux/centos/docker-ce.repo
yum install -y docker-ce docker-ce-cli containerd.io
systemctl start docker
systemctl enable docker

基本设置

设置国内镜像源

1
2
3
4
5
6
7
8
cat > /etc/docker/daemon.json <<EOF
{
"registry-mirrors":["https://mirror.ccs.tencentyun.com"],
"log-driver":"json-file",
"log-opts": {"max-size":"100m", "max-file":"3"}
}
EOF
systemctl restart docker