Docker之离线安装和在线安装
一、离线安装
1、软件包下载
去官网下载docker 安装二进制包,选择适合自己的版本。这里下载的是docker-19.03.9.tgz,在centos7中安装(cento6无法使用,提示linux版本内核版本太低)
https://download.docker.com/linux/static/stable/x86_64/
2、安装docker
tar xvf /opt/docker-24.0.7.tgz -C /usr/local/
cd /usr/local/
cp docker/* /usr/bin/
tee /etc/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
TimeoutStartSec=0
Delegate=yes
KillMode=process
Restart=on-failure
StartLimitBurst=3
StartLimitInterval=60s
[Install]
WantedBy=multi-user.target
EOF
chmod +x /etc/systemd/system/docker.service
systemctl daemon-reload
systemctl start docker
systemctl status docker
docker version
二、在线安装
1、安装脚本在线安装
curl -fsSL https://get.docker.com | bash -s docker --mirror Aliyun
2、镜像加速配置
sudo mkdir -p /etc/docker
sudo tee /etc/docker/daemon.json <<-'EOF'
{
"registry-mirrors": ["https://b49nkdcy.mirror.aliyuncs.com"]
}
EOF
sudo systemctl daemon-reload
sudo systemctl restart docker
三、参考连接
https://zhuanlan.zhihu.com/p/578402141
https://www.cnblogs.com/testway/p/13235683.html