前戏

生产环境为了安全大部分会不通外网,所以会有内网安装的需求

下载地址:

要根据硬件平台下载以免造成不兼容

​https://download.docker.com/​

本文以以下的版本演示

​https://download.docker.com/linux/static/stable/x86_64/docker-20.10.7.tgz​ 

卸载已有的docker

 yum remove docker \
docker-client \
docker-client-latest \
docker-common \
docker-latest \
docker-latest-logrotate \
docker-logrotate \
docker-engine

下载安装包:

wget https://download.docker.com/linux/static/stable/x86_64/docker-20.10.7.tgz
tar -zxf docker-20.10.7.tgz
cp docker/* /use/bin/

内网安装Docker_docker

配置docker.service

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
TimeoutStartSec=0
Delegate=yes
KillMode=process
Restart=on-failure
StartLimitBurst=3
StartLimitInterval=60s

[Install]
WantedBy=multi-user.target

启动dockerd服务

systemctl daemon-reload
systemctl start docker.service

内网安装Docker_docker_02