docker离线安装部署详细步骤

docker离线安装部署

  • 一、准备工作
      • 1、服务器相关
      • 2、官方下载地址
  • 二、安装部署

一、准备工作

1、服务器相关

IP地址 服务器作用 系统 其他
192.168.80.80 docker Anolis OS release 7.9 centos 步骤一致

2、官方下载地址

https://download.docker.com/linux/static/stable/x86_64/

二、安装部署

1、上传解压到/data目录下

tar xf docker-20.10.23.tgz -C /data/			##加压到/data下,替换为自己的数据盘目录

在这里插入图片描述
2、创建软链接并后台启动docker

ln -s /data/docker/* /usr/bin/				##/data/docker/目录下的所有文件链接到/usr/bin/
dockerd &									##后台启动docker

docker离线安装部署详细步骤_第1张图片
3、检查进程和版本

ps -ef | grep docker			##查看进程
docker -v						##查看版本

docker离线安装部署详细步骤_第2张图片
4、配置systemctl启动

注意事项:
1)软链接地址为:/usr/bin/
2)which kill 的路径为:/usr/bin/kill

vim /etc/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
# 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=/usr/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

docker离线安装部署详细步骤_第3张图片
5、测试systemctl启动

pkill dockerd						##结束docker进程
systemctl  daemon-reload			##重载系统文件
systemctl  start  docker			##启动
systemctl  status  docker			##查看状态

docker离线安装部署详细步骤_第4张图片
6、加入开机自启动

systemctl enable docker								##设为开机自启
systemctl list-unit-files | grep docker				##查看确定

docker离线安装部署详细步骤_第5张图片

你可能感兴趣的:(docker,linux,运维,docker)