离线安装
1.下载docker官方离线包
在有外网的环境中先把离线包下载下来
安装包官方地址:https://download.docker.com/linux/static/stable/x86_64/
2.上传离线包到服务器
使用scp命令或ftp工具将下载下来的离线包上传到指定服务器上
3.离线包解压
tar -zxvf docker-20.10.8.tgz
4.复制解压文件到/usr/bin/下
sudo cp docker/* /usr/bin/
5.注册docker为service服务
在/etc/systemd/system/目录下新增docker.service文件
sudo vi /etc/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
# 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
# 如果有搭建私有镜像仓库,--insecure-registry设置为私有镜像仓库地址。
ExecStart=/usr/bin/dockerd --selinux-enabled=false --insecur