参考 :
Linux离线安装Docker - lujuhao - 博客园
linux配置docker源,国内加速镜像(注册阿里云镜像)_docker加速 清华源-优快云博客
Docker:Linux离线安装docker-17.03.2-ce,配置开机自启 - 怒吼的萝卜 - 博客园
说明 : 本次安装包为 docker-19.03.9.tgz
1.下载安装包
docker离线安装包下载地址: https://download.docker.com/linux/static/stable/x86_64/
2.解压
tar zxvf docker-19.03.9.tgz -C ./
3.复制文件
cp docker/* /usr/bin/
4.在/etc/systemd/system目录下创建docker.service文件,并配置如下内容保存
cat > /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
# the default is not to use systemd for cgroups because the delegate issues still
# exists and systemd currently does not support the cgroup feature set required
# for containers run by docker
ExecStart=/usr/bin/dockerd
ExecReload=/bin/kill -s HUP $MAINPID
# Having non-zero Limit*s causes performance problems due to accounting overhead
# in the kernel. We recommend using cgroups to do container-local accounting.
LimitNOFILE=infinity
LimitNPROC=infinity
LimitCORE=infinity
# Uncomment TasksMax if your systemd version supports it.
# Only systemd 226 and above support this version.
#TasksMax=infinity
TimeoutStartSec=0
# set delegate yes so that systemd does not reset the cgroups of docker containers
Delegate=yes
# kill only the docker process, not all processes in the cgroup
KillMode=process
# restart the docker process if it exits prematurely
Restart=on-failure
StartLimitBurst=3
StartLimitInterval=60s
[Install]
WantedBy=multi-user.target
EOF
5.启动docker
# 添加可执行权限
chmod +x /etc/systemd/system/docker.service
# 重载unit配置文件
systemctl daemon-reload
# 启动Docker
systemctl start docker
# 设置开机自启
systemctl enable docker.service
# 查看Docker状态
systemctl status docker
6.配置国内镜像加速
cat > /etc/docker/daemon.json <<'EOF'
{
"registry-mirrors":[
"https://registry.docker-cn.com",
"https://mirrors.tuna.tsinghua.edu.cn",
"https://aeckruos.mirror.aliyuncs.com",
"http://hub-mirror.c.163.com",
"https://docker.mirrors.ustc.edu.cn",
]
}
EOF
systemctl restart docker
docker(15) : 卸载docker_Lxinccode的博客-优快云博客
END。