1.先到官网下载镜像
2.解压docker
tar -xvf docker-20.10.1.tgz
3.复制docker到user/bin目录
cp docker/* /usr/bin
4.配置docker服务(没有docker.service的话创建一个)
/etc/systemd/system/docker.service
5.添加配置
# 添加
[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
TimeoutStartSec=0
Delegate=yes
KillMode=process
Restart=on-failure
StartLimitBurst=3
StartLimitInterval=60s
[Install]
WantedBy=multi-user.target
6.赋执行权限
chmod +x /etc/systemd/system/docker.service
7.重新加载 systemd
守护进程配置文件
systemctl daemon-reload
8.启动docker
systemctl start docker
9.设置开机自启动
systemctl enable docker.service
10.查看docker状态
systemctl status docker
11.重启docker
systemctl restart docker