linux离线安装docker

需求:

服务器部署是在内网,无法连接外网,所以特地记录下离线安装docker

实践:

一、rpm包方式

1、下载rpm离线安装包

个人提供的云盘地址(没有密码):https://www.aliyundrive.com/s/uUwHAdm3XMa

也可以去下面的官网地址下载:
官方下载地址:https://download.docker.com/linux/centos/7/x86_64/stable/Packages/

2、上传离线安装包

将两个rpm离线包上传到同一个目录下。我这里直接放在了/home/docker下
在这里插入图片描述

3、通过Yum安装Docker包
sudo yum install *.rpm
4、开启Docker服务
# 设置自启动
sudo systemctl enable docker
# 开启服务
sudo systemctl start docker
5、查看docker状态
sudo systemctl status docker

在这里插入图片描述

二、tgz包方式(推荐用这个)

1、下载tgz离线安装包

下载地址:https://download.docker.com/linux/static/stable/x86_64/
我们这里下载的是docker-18.09.7.tgz (根据自己系统版本下载)
在这里插入图片描述

2、上传到服务器并解压
tar -zxvf docker-18.09.7.tgz 
3、复制到/usr/bin
cp docker/* /usr/bin
4、将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.target
5、启动服务
#添加文件权限并启动docker
chmod +x /etc/systemd/system/docker.service
#重载unit配置文件
systemctl daemon-reload
#启动docker
systemctl start docker       
#设置开机自启
systemctl enable docker.service
6、查看状态
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

  • 1
    点赞
  • 11
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值