欢迎来到尧图网

客户服务 关于我们

您的位置:首页 > 财经 > 金融 > Centos离线安装Docker(无坑版)

Centos离线安装Docker(无坑版)

2025/5/2 11:11:08 来源:https://blog.csdn.net/u010029821/article/details/147634773  浏览:    关键词: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安装

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com

热搜词