下载docker二制文件

wget https://mirrors.ustc.edu.cn/docker-ce/linux/static/stable/x86_64/docker-26.1.4.tgz
wget https://mirrors.aliyun.com/docker-ce/linux/static/stable/x86_64/docker-26.1.4.tgz

## 解压下载好的压缩包
tar -zxvf docker-26.1.4.tgz

## 移动解压出来的二进制文件到 /usr/bin 目录中
mv docker/* /usr/bin/


## 测试启动
dockerd

创建docker的系统服务文件

#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.service添加执行权限
chmod +x /usr/lib/systemd/system/docker.service

# 重新加载系统控制器
systemctl daemon-reload

创建 daemon.json 配置文件

#vi /etc/docker/daemon.json
{
    "registry-mirrors":[
        "https://docker.mirrors.ustc.edu.cn"
    ],
    "data-root":"/data/docker",
    "log-driver":"json-file",
    "log-opts":{
        "max-size":"10m","max-file":"5"
    }
}

启动docker

## 启动docker
systemctl start docker

## 开机自启动
systemctl enable docker

## 验证docker 查看docker 版本:
docker -v