一、准备工作
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
3、检查进程和版本
ps -ef | grep docker ##查看进程
docker -v ##查看版本
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
5、测试systemctl
启动
pkill dockerd ##结束docker进程
systemctl daemon-reload ##重载系统文件
systemctl start docker ##启动
systemctl status docker ##查看状态
6、加入开机自启动文章来源:https://www.toymoban.com/news/detail-597562.html
systemctl enable docker ##设为开机自启
systemctl list-unit-files | grep docker ##查看确定
文章来源地址https://www.toymoban.com/news/detail-597562.html
到了这里,关于docker离线安装部署详细步骤的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!