這期內(nèi)容當(dāng)中小編將會(huì)給大家?guī)?lái)有關(guān)Docker如何實(shí)現(xiàn)在線與離線安裝,文章內(nèi)容豐富且以專業(yè)的角度為大家分析和敘述,閱讀完這篇文章希望大家可以有所收獲。
成都創(chuàng)新互聯(lián)是一家專注于成都做網(wǎng)站、成都網(wǎng)站制作、成都外貿(mào)網(wǎng)站建設(shè)與策劃設(shè)計(jì),輝南網(wǎng)站建設(shè)哪家好?成都創(chuàng)新互聯(lián)做網(wǎng)站,專注于網(wǎng)站建設(shè)十多年,網(wǎng)設(shè)計(jì)領(lǐng)域的專業(yè)建站公司;建站業(yè)務(wù)涵蓋:輝南等地區(qū)。輝南做網(wǎng)站價(jià)格咨詢:13518219792這里采用yum源命令安裝前期準(zhǔn)備的依賴包,包括yum-utils、device-mapper-persistent-data、lvm2
sudo yum install -y yum-utils device-mapper-persistent-data lvm2
因?yàn)楣俜界R像倉(cāng)庫(kù)網(wǎng)速較慢,在此設(shè)置阿里云鏡像代理,以便快速下載、上傳鏡像。
sudo yum-config-manager --add-repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
接下來(lái)安裝Docker-CE 社區(qū)版,通過(guò)以下命令查看docker社區(qū)版安裝包列表。如下圖所示各docker版本信息。
yum list docker-ce --showduplicates | sort -r
選擇對(duì)應(yīng)版本安裝docker
sudo yum install docker-ce.x86_64
啟動(dòng)
sudo systemctl enable docker
sudo systemctl start docker
驗(yàn)證:查看版本信息命令,出現(xiàn)下圖時(shí)表明安裝成功。
docker version
提供以下三種方式下載docker離線安裝包
Docker官方地址:docker down
1.百度云下載地址: https://pan.baidu.com/s/1tZpsOvY0wmCfwHXlNJuq8Q 提取碼: rhaq
2.有網(wǎng)服務(wù)器執(zhí)行命令下載:wget https://download.docker.com/linux/static/stable/x86_64/docker-18.09.6.tgz
3.官方參考文檔:https://docs.docker.com/install/linux/docker-ce/binaries/#install-static-binaries
將已下載好的docker離線包拷貝到服務(wù)器,解壓壓縮包
tar -xvf docker-18.09.6.tgz
將解壓出來(lái)的docker文件內(nèi)容移動(dòng)到 /usr/bin/ 目錄下
cp docker/* /usr/bin/
注冊(cè)編輯docker服務(wù)
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=/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