离线部署
本文章向大家介绍CentOS离线安装docker,主要包括CentOS离线安装docker使用实例、应用技巧、基本知识点总结和需要注意事项,具有一定的参考价值,需要的朋友可以参考一下。
- CentOS版本:7.9
- docker版本:20.10.1
- 创建下载目录
mkdir -p /data/docker/download
cd /data/docker/download
- 下载docker离线安装包
wget https://download.docker.com/linux/static/stable/x86_64/docker-20.10.1.tgz
- 解压安装包
tar -zxvf docker-20.10.1.tgz
- 将二进制文件移动到指定位置 /usr/local/bin
mv /data/docker/download/docker/* /usr/local/bin
- 建立docker数据存放目录 /data/docker/data/docker
mkdir -p /data/docker/data/docker
- 创建 docker 服务
vim /usr/lib/systemd/system/docker.service
- 编辑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/local/bin/dockerd --data-root /data/docker/data/docker
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
- 重新加载配置
systemctl daemon-reload
启动
- 启动docker服务
systemctl start docker
- 设置开机自启动
systemctl enable docker
- THE END -
最后修改:2024年3月2日
非特殊说明,本博所有文章均为博主原创。
如若转载,请注明出处:https://ospf.me/docker
共有 0 条评论