服务器部署是在内网,无法连接外网,所以特地记录下离线安装docker
实践: 一、centos7系统 1、下载rpm离线安装包个人提供的云盘地址(没有密码):https://www.aliyundrive.com/s/uUwHAdm3XMa
也可以去下面的官网地址下载:
官方下载地址:https://download.docker.com/linux/centos/7/x86_64/stable/Packages/
将两个rpm离线包上传到同一个目录下。我这里直接放在了/home/docker下
sudo yum install *.rpm4、开启Docker服务
# 设置自启动 sudo systemctl enable docker # 开启服务 sudo systemctl start docker5、查看docker状态
sudo systemctl status docker二、redhat系统 1、下载tgz离线安装包
下载地址:https://download.docker.com/linux/static/stable/x86_64/
我们这里下载的是docker-18.09.7.tgz (根据自己系统版本下载)
tar -zxvf docker-18.09.7.tgz3、复制到/usr/bin
cp docker/* /usr/bin4、将docker设置成服务
#新建服务 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 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.target5、启动服务
#添加文件权限并启动docker chmod +x /etc/systemd/system/docker.service #重载unit配置文件 systemctl daemon-reload #启动docker systemctl start docker #设置开机自启 systemctl enable docker.service6、查看状态
systemctl status docker参考:
CentOS7离线安装Docker
https://cookcode.blog.csdn.net/article/details/80158997?spm=1001.2014.3001.5506
redhat 离线安装 docker
https://blog.csdn.net/zzwpublic/article/details/107397212?spm=1001.2014.3001.5506



