手动安装

去官方网站下载Docker安装文件

https://download.docker.com/linux/static/stable/x86_64/

下载安装包

wget -c https://download.docker.com/linux/static/stable/x86_64/docker-25.0.4.tgz

解压安装包

tar -xzvf docker-25.0.4.tgz

拷贝文件

mv docker/* /usr/bin

创建服务

vi /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
TimeoutStartSec=0
Delegate=yes
KillMode=process
Restart=on-failure
StartLimitBurst=3
StartLimitInterval=60s
[Install]
WantedBy=multi-user.target

设置Docker代理

# 创建文件夹
mkdir -p /etc/docker
# 编辑文件
vi /etc/docker/daemon.json

{
  "registry-mirrors" : [
    "https:\/\/hub.uuuadc.top",
    "https:\/\/docker.anyhub.us.kg",
    "https:\/\/dockerhub.jobcher.com",
    "https:\/\/dockerhub.icu",
    "https:\/\/docker.ckyl.me",
    "https:\/\/docker.awsl9527.cn"
  ]
}
 

启动Docker服务

systemctl start docker

设置开机自启动

systemctl enable docker

检查Docker版本

docker version