1.下載安裝包
cd /home
curl -O https://download.docker.com/linux/static/stable/x86_64/docker-20.10.19.tgz
2.安裝
確保/home下有docker-20.10.19.tgz安裝包後,執行命令完成解壓
tar -xzf docker-20.10.19.tgz
移動解壓後的全部內容到/usr/bin/下
mv docker/* /usr/bin/
3.編譯配置檔案
編輯docker.service檔案
vi /usr/lib/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 ExecStart=/usr/bin/dockerd ExecReload=/bin/kill -s HUP $MAINPID LimitNOFILE=infinity LimitNPROC=infinity TimeoutStartSec=0 Delegate=yes KillMode=process Restart=on-failure StartLimitBurst=3 StartLimitInterval=60s [Install] WantedBy=multi-user.target
新增docker.service檔案的許可權
chmod +x /usr/lib/systemd/system/docker.service systemctl daemon-reload
建立daemon.json檔案
cd /etc mkdir docker cd docker touch daemon.json vi daemon.json
複製下面的內容
{ "registry-mirrors": [ "https://docker.unsee.tech" ] }
reload內容、啟動docker、設定開機啟動
systemctl daemon-reload systemctl start docker systemctl enable docker
4.驗證docker安裝是否成功
docker -v