這篇文章給大家分享的是有關(guān)Linux中如何離線安裝docker的內(nèi)容。小編覺得挺實用的,因此分享給大家做個參考,一起跟隨小編過來看看吧。
1. 準(zhǔn)備docker離線包
docker官方離線包下載地址
下載需要安裝的docker版本,我此次下載的是
docker-17.03.2-ce.tgz版本
2. 準(zhǔn)備docker.service 系統(tǒng)配置文件
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=/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
3. 準(zhǔn)備安裝腳本和卸載腳本
安裝腳本 install.sh
#!/bin/sh echo '解壓tar包...' tar -xvf $1 echo '將docker目錄移到/usr/bin目錄下...' cp docker/* /usr/bin/ echo '將docker.service 移到/etc/systemd/system/ 目錄...' cp docker.service /etc/systemd/system/ echo '添加文件權(quán)限...' chmod +x /etc/systemd/system/docker.service echo '重新加載配置文件...' systemctl daemon-reload echo '啟動docker...' systemctl start docker echo '設(shè)置開機(jī)自啟...' systemctl enable docker.service echo 'docker安裝成功...' docker -v
卸載腳本 uninstall.sh
#!/bin/sh echo '刪除docker.service...' rm -f /etc/systemd/system/docker.service echo '刪除docker文件...' rm -rf /usr/bin/docker* echo '重新加載配置文件' systemctl daemon-reload echo '卸載成功...'
4. 安裝
4.1 此時目錄為:(只需要關(guān)注docker-17.03.2-ce.tgz、docker.service、install.sh、uninstall.sh即可)
4.2 執(zhí)行腳本 sh install.sh docker-17.03.2-ce.tgz
執(zhí)行過程如下:
待腳本執(zhí)行完畢后,執(zhí)行 docker -v
發(fā)現(xiàn)此時docker已安裝成功,可以用 docker --help
查看docker命令,從現(xiàn)在開始你就可以自己安裝image和container了
sh uninstall.sh
4.3 如果你想卸載docker,此時執(zhí)行腳本 sh uninstall.sh
即可,執(zhí)行過程如下:
此時輸入 docker -v
,發(fā)現(xiàn)docker已經(jīng)卸載
感謝各位的閱讀!關(guān)于“Linux中如何離線安裝docker”這篇文章就分享到這里了,希望以上內(nèi)容可以對大家有一定的幫助,讓大家可以學(xué)到更多知識,如果覺得文章不錯,可以把它分享出去讓更多的人看到吧!
當(dāng)前文章:Linux中如何離線安裝docker-創(chuàng)新互聯(lián)
瀏覽路徑:http://www.rwnh.cn/article40/djpceo.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站收錄、自適應(yīng)網(wǎng)站、網(wǎng)站設(shè)計、微信公眾號、企業(yè)網(wǎng)站制作、網(wǎng)站導(dǎo)航
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)
猜你還喜歡下面的內(nèi)容