Centos离线安装Docker(无坑版)

1、下载并上传docker离线安装包

官方地址:安装包下载

2、上传到离线安装的服务器解压

复制代码
tar -zxvf docker-28.1.1.tgz

#拷贝解压二进制文件到相关目录
cp docker/* /usr/bin/

3、创建docker启动文件

复制代码
cat << EOF > /usr/lib/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
ExecStart=/usr/bin/dockerd
ExecReload=/bin/kill -s HUP $MAINPID
TimeoutStartSec=0
RestartSec=2
Restart=always
StartLimitBurst=3
StartLimitInterval=60s
LimitNOFILE=infinity
LimitNPROC=infinity
LimitCORE=infinity
TasksMax=infinity
Delegate=yes
KillMode=process
OOMScoreAdjust=-500

[Install]
WantedBy=multi-user.target

EOF

4、创建Containerd启停文件

复制代码
cat << EOF > /usr/lib/systemd/system/containerd.service 

# Copyright The containerd Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

[Unit]
Description=containerd container runtime
Documentation=https://containerd.io
After=network.target local-fs.target

[Service]
ExecStartPre=-/sbin/modprobe overlay
ExecStart=/usr/bin/containerd

Type=notify
Delegate=yes
KillMode=process
Restart=always
RestartSec=5

# Having non-zero Limit*s causes performance problems due to accounting overhead
# in the kernel. We recommend using cgroups to do container-local accounting.
LimitNPROC=infinity
LimitCORE=infinity

# Comment TasksMax if your systemd version does not supports it.
# Only systemd 226 and above support this version.
TasksMax=infinity
OOMScoreAdjust=-999

[Install]
WantedBy=multi-user.target

EOF

5、启动Containerd

复制代码
systemctl enable --now containerd

systemctl status containerd

6、启动docker

复制代码
systemctl enable --now docker

systemctl status docker

二、镜像包处理

1、从有镜像包的服务器导出镜像

复制代码
docker save -o oracle-12c.zip 21789d4d876f

2、上传导出的镜像到离线服务器上

复制代码
docker load < oracle-12c.zip

有了镜像后,就可以正常创建服务了。

参考地址:CentOS7.9安装

相关推荐
M78佐菲5 小时前
Linux学习笔记:TCP协议
linux·笔记·学习·tcp/ip·算法
Brilliantwxx5 小时前
【Linux】 进程(9)程序与进程地址空间(基础+进阶+面试题)
linux·运维·服务器·开发语言·c++
BullSmall5 小时前
第三方软件安全-Dependency‑Track Docker 部署
安全·docker·容器
不怕犯错,就怕不做6 小时前
git prune 自动删除本地记录中那些远程已经不存在的分支引用
linux·服务器·git
harmony&6 小时前
Docker 容器技术从入门到实战:容器、网络、存储与监控全解析
docker·云原生
一池秋_7 小时前
arm低配linux设备,桌面应用冷启动提速方法
linux·运维·arm开发
惜离殇7 小时前
从零开始的敲代码生活--Linux应用软件(文件操作基础1)
linux·c语言·文件操作·标准io
IT大白鼠9 小时前
Docker 私有仓库管理:Harbor 企业级仓库搭建与镜像全生命周期管理
运维·docker·容器
闲云野鹤在人间10 小时前
OpenStack架构介绍和安装流程
linux·网络·架构·openstack
我命由我1234510 小时前
Linux - Linux/POSIX 路径斜杠折叠规则
linux·运维·服务器·android studio·android jetpack·android-studio·android runtime