1、下载docker的安装包
Index of linux/static/stable/x86_64/ (docker.com)
2、将下载好的安装包上传到centos7-linux系统上,用ftp上传即可
3、解压
[root@bogon mnt]# tar -zxvf docker-20.10.12.tgz
docker/
docker/docker-init
docker/docker
docker/containerd-shim
docker/containerd-shim-runc-v2
docker/runc
docker/dockerd
docker/ctr
docker/docker-proxy
docker/containerd
[root@bogon mnt]#
解压完后会生成docker目录
4、将解压出来的docker文件内的内容复制到/usr/bin/目录下
[root@bogon mnt]# cp docker/* /usr/bin/
5、进入/etc/systemd/system/目录,并创建docker.service文件
[root@bogon mnt]# cd /etc/systemd/system/
[root@bogon system]# touch docker.service
6、打开docker.service文件,将以下内容复制
[root@bogon system]# vim docker.service
注意: --insecure-registry=192.168.200.128 此处改为你自己服务器ip
[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 --selinux-enabled=false --insecure-registry=192.168.200.128
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
7、给docker.service文件添加执行权限
[root@bogon system]# chmod 777 /etc/systemd/system/docker.service
8、重新加载配置文件(每次修改docker.service文件时都要重新加载下)
[root@bogon system]# systemctl daemon-reload
9、启动docker
[root@bogon system]# systemctl start docker
10、查看docker状态
11、设置开机自启动
[root@bogon system]# systemctl enable docker.service
以上就是linux离线安装docker的全部步骤