docker 離線安裝部署
下載地址
https://download.docker.com/linux/static/stable/x86_64/
這里可以下載你實際使用到的版本

我使用的是docker-20.10.9-ce.tgz
解壓命令
tar -zxvf docker-20.10.9-ce.tgz
解壓之后的檔案復制到 /usr/bin/ 目錄下
cp docker/* /usr/bin/
在/etc/systemd/system/目錄下新增docker.service檔案
通過 vi 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 --selinux-enabled=false
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
啟動docker
#給docker.service檔案添加執行權限
chmod +x /etc/systemd/system/docker.service
#重新加載組態檔(每次有修改docker.service檔案時都要重新加載下)
systemctl daemon-reload
#啟動docker
systemctl start docker
設定開機啟動
#systemctl enable docker.service
#查看docker服務狀態
systemctl status docker
docker-compose 離線安裝
首先下載離線檔案
https://github.com/docker/compose/releases
選擇自己對應的版本進行下載
上傳至服務器之后,將檔案遷移到這個位置將檔案轉移至/usr/local/bin/
mv docker-compose-Linux-x86_64 /usr/local/bin/docker-compose
添加權限:
chmod +x /usr/local/bin/docker-compose
檢查狀態
docker-compose -v

轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/396201.html
標籤:其他
