一、準(zhǔn)備工作
1、服務(wù)器相關(guān)
IP地址 | 服務(wù)器作用 | 系統(tǒng) | 其他 |
---|---|---|---|
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下,替換為自己的數(shù)據(jù)盤目錄
2、創(chuàng)建軟鏈接并后臺啟動docker
ln -s /data/docker/* /usr/bin/ ##將/data/docker/目錄下的所有文件鏈接到/usr/bin/下
dockerd & ##后臺啟動docker
3、檢查進(jìn)程和版本
ps -ef | grep docker ##查看進(jìn)程
docker -v ##查看版本
4、配置systemctl
啟動
注意事項:
1)軟鏈接地址為:/usr/bin/
2)which kill 的路徑為:/usr/bin/kill
vim /etc/systemd/system/docker.service
添加內(nèi)容如下:
[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 ##結(jié)束docker進(jìn)程
systemctl daemon-reload ##重載系統(tǒng)文件
systemctl start docker ##啟動
systemctl status docker ##查看狀態(tài)
6、加入開機(jī)自啟動文章來源:http://www.zghlxwxcb.cn/news/detail-597562.html
systemctl enable docker ##設(shè)為開機(jī)自啟
systemctl list-unit-files | grep docker ##查看確定
文章來源地址http://www.zghlxwxcb.cn/news/detail-597562.html
到了這里,關(guān)于docker離線安裝部署詳細(xì)步驟的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!