当前位置: 首页 > news >正文

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.targetEOF

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/containerdType=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.targetEOF

5、启动Containerd

systemctl enable --now containerdsystemctl status containerd

6、启动docker

systemctl enable --now dockersystemctl status docker

二、镜像包处理

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

docker save -o oracle-12c.zip 21789d4d876f

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

docker load < oracle-12c.zip

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

参考地址:CentOS7.9安装

相关文章:

  • 硬件工程师面试常见问题(10)
  • [250430] Kali Linux 存储库密钥丢失导致所有用户无法正常更新 APT
  • 如何使用C语言手搓斐波那契数列?
  • 【数学建模国奖速成系列】优秀论文绘图复现代码(二)
  • OCR身份证识别(正反面)_个人证照OCR识别_开放API接口使用指南
  • AI重构家居营销新范式:DeepSeek如何破解行业流量与转化困局?
  • 在pycharm中创建Django项目并启动
  • 在 API 模拟阶段:Apipost vs. Faker.js vs. Postman —— 为什么 Apipost 是最优选择
  • 科学数据可视化工具库visIt安装和使用
  • 「动态规划::背包」01背包 / AcWing 2(C++)
  • 解决 RN Switch 组件在安卓端样式很丑的问题
  • Databend 产品月报(2025年4月)
  • 人工智能数学基础(六):数理统计
  • 大屏/门户页面兼容各种分辨率或电脑缩放
  • 39.RocketMQ高性能核心原理与源码架构剖析
  • tailwindcss如何改变antd子组件的样式
  • CSS实现DIV水平与垂直居中方法总结
  • 基于单片机的音频信号处理系统设计(一)
  • 第十一节:Shell脚本编程
  • mysql模糊查询
  • 新能源车盈利拐点:8家上市车企去年合计净利854亿元,多家扭亏
  • 全文丨中华人民共和国民营经济促进法
  • 内蒙古公开宣判144件毁林毁草刑案,单起非法占用林地逾250亩
  • 经营业绩持续稳中向好,国铁集团2024年度和2025年一季度财务决算公布
  • “80后”蒋美华任辽宁阜新市副市长
  • 为治理商家“卷款跑路”“退卡难”,预付式消费司法解释5月起实施