下载地址:https://download.docker.com/linux/static/stable/x86_64/
mkdir -p /opt/src && cd /opt/src wget https://download.docker.com/linux/static/stable/x86_64/docker-20.10.17.tgz
tar -xf docker-20.10.17.tgz cp docker/* /usr/bin
mkdir /etc/docker ## 配置国内的镜像源,加速镜像拉取 cat > /etc/docker/daemon.json << EOF { "registry-mirrors": ["https://b9pmyelo.mirror.aliyuncs.com"] } EOF
1、生成配置文件
cat > /usr/lib/systemd/system/docker.service << EOF [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 EOF2、启动并设置开机自启
systemctl daemon-reload systemctl start docker systemctl enable docker docker --version
## 下载安装包,可自行调整版本 mkdir -p /opt/src && cd /opt/src wget https://download.docker.com/linux/static/stable/x86_64/docker-20.10.17.tgz ## 安装docker tar -xf docker-20.10.17.tgz cp docker/* /usr/bin ## 创建配置文件 mkdir /etc/docker ## 配置国内的镜像源,加速镜像拉取 cat > /etc/docker/daemon.json << EOF { "registry-mirrors": ["https://b9pmyelo.mirror.aliyuncs.com"] } EOF ## 生成systemd配置文件 cat > /usr/lib/systemd/system/docker.service << EOF [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 EOF ## 启动并设置开启自启 systemctl daemon-reload systemctl start docker systemctl enable docker docker --version