centos离线(内网环境无外网)安装docker

#编程技术 2023-10-18 09:59:29 | 全文 582 字,阅读约需 2 分钟 | 加载中... 次浏览

👋 相关阅读


1、环境

1、centos7 内网环境 无外网连接,yum 安装会失效,采用离线安装包方式安装 docker

2、下载安装包

百度网盘: 链接:https://pan.baidu.com/s/1ArPt-NhjtdKTBW3I4BE-iQ 提取码:ngyh

链接: https://pan.baidu.com/s/1WcFdBLKQWJ8JF0LM3_UkOA?pwd=463f 提取码: 463f

以上两个链接是一样的文件,防止链接失效,两个备用

文件是 docker-19.03.9 这个版本

3、安装脚本

#!/bin/sh
## docker安装脚本

## 解压docker文件
tar -zxvf docker-19.03.9.tgz

## 将docker目录移到/usr/bin目录下...
mv docker/* /usr/bin/

## 写入docker 配置文件
cat >> /etc/systemd/system/docker.service << EOF
[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
EOF

## 添加文件权限
chmod 755 /etc/systemd/system/docker.service

## 重新加载配置文件
systemctl daemon-reload

## 启动docker
systemctl start docker

## 设置开机自启动
systemctl enable docker.service

## 删除docker 解压文件
rm -rf ./docker

sleep 1
clear

把安装脚本复制到安装包同一路径下,保存为 docker.sh 文件

赋予docker.sh 执行权限

chmod 755 docker.sh

4、安装

执行docker安装命令

sh docker.sh

等待安装完成

5、测试安装

docker ps -a
docker info
docker -v
docker images

上述命令挨个执行一遍,看看控制台是否有输出,有输出证明安装成功

VIA

centos7 离线(内网环境无外网) 安装docker - 明知山有小脑斧 - 博客园 https://www.cnblogs.com/sunxun001/p/16952477.html

Edit | Last updated on 2024-05-20 21:36:45




×