配置宿主机网卡转发
vim /etc/sysctl.d/docker.conf
net.ipv4.ip_forward=1
sysctl -p /etc/sysctl.d/docker.conf
安装Docker
下载地址:https://download.docker.com/linux/static/stable/x86_64/
# 这里我使用的版本是docker-18.06.2-ce.tgz
wget https://download.docker.com/linux/static/stable/x86_64/docker-18.06.2-ce.tgz
tar xf docker-24.0.7.tgz
cd docker
# 将docker目录下的二进制文件都复制到/usr/bin目录下
cp -r * /bin/
# 将Docker 注册到系统服务
vim /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
# 启动服务
systemctl daemon-reload
systemctl enable docker
systemctl start docker
# 配置源加速和储存路径 注册地址https://cr.console.aliyun.com/cn-hangzhou/instances/mirrors
mkdir /etc/docker
vim /etc/docker/daemon.json
{
"registry-mirrors" : [
"https://ij3sa44e.mirror.aliyuncs.com"
],
"data-root": "/data/docker"
}
# 重启服务 安装完成
systemctl restart docker
# 查看docker信息
docker info
Comments NOTHING