本次采用二进制安装,若使用yum安装也是同样效果:
[root@k8s-master ~]# wget https://download.docker.com/linux/static/stable/x86_64/docker-19.03.9.tgz
[root@k8s-master opt]# tar zxvf docker-19.03.9.tgz
[root@k8s-master docker]# mv /opt/docker/* /usr/bin/
使用systemd管理docker:
[root@k8s-master opt]# vim /usr/lib/systemd/system/docker.service
[Unit]
Description=Docker Application Container Engine
Documentation=https://docs.docker.com
After=network-online.target firewalld.service
Wants=network-online.target
[Service]
Type=notify
ExecStart=/usr/bin/dockerd
ExecReload=/bin/kill -s HUP $MAINPID
LimitNOFILE=infinity
LimitNPROC=infinity
LimitCORE=infinity
TimeoutStartSec=0
Delegate=yes
KillMode=process
Restart=on-failure
StartLimitBurst=3
StartLimitInterval=60s
[Install]
WantedBy=multi-user.target
配置docker,registry-mirrors 阿里云镜像加速器:
{
"registry-mirrors": ["https://b9pmyelo.mirror.aliyuncs.com"]
}
启动,设置开机自启:
[root@k8s-master opt]# systemctl daemon-reload
[root@k8s-master opt]# systemctl start docker.service
[root@k8s-master opt]# systemctl enable docker.service
[root@k8s-master opt]# mkdir /etc/docker
注:在另外俩个节点中做相同操作