栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 系统运维 > 运维 > Linux

linux离线安装docker

Linux 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

linux离线安装docker

需求:

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

实践: 一、centos7系统 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

二、redhat系统 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

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/864841.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号