免费A级毛片无码专区网站-成人国产精品视频一区二区-啊 日出水了 用力乖乖在线-国产黑色丝袜在线观看下-天天操美女夜夜操美女-日韩网站在线观看中文字幕-AV高清hd片XXX国产-亚洲av中文字字幕乱码综合-搬开女人下面使劲插视频

二進(jìn)制安裝Dokcer

寫在前邊考慮到很多生產(chǎn)環(huán)境是內(nèi)網(wǎng),不允許外網(wǎng)訪問的 。恰好我司正是這種場(chǎng)景,寫一篇二進(jìn)制方式安裝Docker的教程,用來幫助實(shí)施同事解決容器部署的第一個(gè)難關(guān) 。
本文將以二進(jìn)制安裝方式,在CentOS7.9上安裝Docker 19.03.9,具有一定的通用性,其他版本也可參考本文 。讓我們開始吧 。
適合場(chǎng)景

  1. 無法訪問外網(wǎng)的服務(wù)器環(huán)境
  2. 內(nèi)網(wǎng)沒有Docker軟件源
  3. 需要離線安裝Docker
  4. 使用rpm或deb等Docker安裝包出現(xiàn)依賴地獄的情況,而實(shí)施人員無力解決
  5. 支持Systemd服務(wù)配置
  6. 支持多種架構(gòu):aarch64/armel/armhf/ppc64le/s390x/x86_64
下載Docker二進(jìn)制包https://download.docker.com/linux/static/stable/ ,根據(jù)架構(gòu)選擇目錄,本文以x86_64舉例
二進(jìn)制安裝Dokcer

文章插圖
將壓縮包上傳到服務(wù)器
二進(jìn)制安裝Docker在服務(wù)器上,解壓壓縮包
tar -xvf docker-19.03.0-ce.tgz將解壓出的docker/bin目錄下的可執(zhí)行文件復(fù)制到/usr/bin
【二進(jìn)制安裝Dokcer】cp docker/* /usr/bin/將docker注冊(cè)為 Systemd 的 service
cat > /etc/systemd/system/docker.service <<EOF[Unit]Description=Docker Application Container EngineDocumentation=https://docs.docker.comAfter=network-online.target firewalld.serviceWants=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 dockerExecStart=/usr/bin/dockerdExecReload=/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=infinityLimitNPROC=infinityLimitCORE=infinity# Uncomment TasksMax if your systemd version supports it.# Only systemd 226 and above support this version.#TasksMax=infinityTimeoutStartSec=0# set delegate yes so that systemd does not reset the cgroups of docker containersDelegate=yes# kill only the docker process, not all processes in the cgroupKillMode=process# restart the docker process if it exits prematurelyRestart=on-failureStartLimitBurst=3StartLimitInterval=60s[Install]WantedBy=multi-user.targetEOF為 docker.service添加可執(zhí)行權(quán)限
chmod +x /etc/systemd/system/docker.service設(shè)置docker存儲(chǔ)目錄到大硬盤目錄、設(shè)置私有鏡像倉庫地址(可選,注意替換目錄位置與私有鏡像倉庫URL)
mkdir /etc/dockermkdir /data1/docker #/data1是大硬盤目錄# 主要關(guān)注data-root的值是大硬盤目錄存放docker相關(guān)文件的目錄# insecure-registries后邊的值是私有鏡像倉庫地址,多個(gè)私有鏡像倉庫地址配置格式為["倉庫1","倉庫2"]# exec-opts部分針對(duì)于部署k8s做的預(yù)配置,可以減少容器日志保存大小及配合kubelet使用systemdcat > /etc/docker/daemon.json <<EOF{"insecure-registries":["10.2.41.191:5000"],"data-root":"/data1/docker","exec-opts": ["native.cgroupdriver=systemd"],"log-driver": "json-file","log-opts": {"max-size": "20m"},"storage-driver": "overlay2","storage-opts": ["overlay2.override_kernel_check=true"]}EOF啟動(dòng)docker并設(shè)置開機(jī)自啟
systemctl daemon-reloadsystemctl enable --now docker.service驗(yàn)證安裝結(jié)果
systemctl status docker #查看docker服務(wù)狀態(tài)docker -v #查看docker版本
本文同步發(fā)布在本人CSDN https://blog.csdn.net/u012586326 與 博客園 https://www.cnblogs.com/hellxz/ ,禁止爬蟲與未經(jīng)允許的洗稿 。

    經(jīng)驗(yàn)總結(jié)擴(kuò)展閱讀