国产成人精品久久免费动漫-国产成人精品天堂-国产成人精品区在线观看-国产成人精品日本-a级毛片无码免费真人-a级毛片毛片免费观看久潮喷

您的位置:首頁技術文章
文章詳情頁

Docker 安裝及配置鏡像加速的實現

瀏覽:3日期:2024-11-05 16:16:12
Docker 版本

隨著 Docker 的飛速發展,企業級功能的上線,更好的服務意味著需要支付一定的費用,目前 Docker 被分為兩個版本:

community-edition 社區版 enterprise-edition 企業版

Docker 企業版(EE)專為企業開發和 IT 團隊設計,可在大規模生產中構建,運送和運行關鍵業務應用程序。Docker EE 集成,認證和支持,為企業提供業界最安全的容器平臺,實現所有應用程序的現代化。作為一個以應用為中心的平臺,Docker EE 旨在加速和保護整個軟件供應鏈,從開發到在任何基礎設施上運行的生產。

我們學習 Docker 使用 CE 社區版即可。

Docker 安裝及配置鏡像加速的實現

在 CentOS 上安裝 Docker 引擎

Docker 安裝及配置鏡像加速的實現

Docker 支持 Mac Windows Linux,本文使用 Linux 環境教大家如何基于 CentOS 安裝 Docker 及配置鏡像加速。

官方文檔:https://docs.docker.com/

系統要求

官網提示如果要安裝 Docker Engine,您需要一個 CentOS 7 以及以上的穩定版本。

卸載舊版本

較舊的 Docker 版本為 docker 或 docker-engine。 如果已安裝這些程序,請卸載它們以及相關的依賴項。

sudo yum remove docker docker-client docker-client-latest docker-common docker-latest docker-latest-logrotate docker-logrotate docker-engine

Docker 鏡像、容器、數據卷和網絡數據都保存在 /var/lib/docker/。新的 Docker 引擎包現在為 Docker-ce。

設置 yum 源

安裝 yum-utils 軟件包(提供了 yum-config-manager 程序)并設置穩定的 yum 源方便下載 Docker Engine。

# 安裝 yum-utilssudo yum install -y yum-utils# 設置 yum 源為阿里云方便下載 Docker Enginesudo yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repoDocker 安裝

安裝最新版本的 Docker Engine 和容器。

sudo yum install docker-ce docker-ce-cli containerd.io

Docker 安裝及配置鏡像加速的實現

安裝過程中如果提示您接受 GPG 密鑰,請驗證指紋是否與 060A 61C5 1B55 8A7F 742B 77AA C52F EB6B 621E 9F35 匹配,如果是,請接受。

Docker 的啟動與停止

# 啟動 dockersudo systemctl start docker# 停止 dockersudo systemctl stop docker# 重啟 dockersudo systemctl restart docker# 設置開機啟動sudo systemctl enable docker# 查看 docker 狀態sudo systemctl status docker# 查看 docker 內容器的運行狀態sudo docker stats# 查看 docker 概要信息sudo docker info# 查看 docker 幫助文檔sudo docker --help安裝校驗

[root@localhost ~]# docker -vDocker version 19.03.12, build 48a66213fe[root@localhost ~]# docker versionClient: Docker Engine - Community Version: 19.03.12 API version: 1.40 Go version: go1.13.10 Git commit: 48a66213fe Built: Mon Jun 22 15:46:54 2020 OS/Arch: linux/amd64 Experimental: falseServer: Docker Engine - Community Engine: Version: 19.03.12 API version: 1.40 (minimum version 1.12) Go version: go1.13.10 Git commit: 48a66213fe Built: Mon Jun 22 15:45:28 2020 OS/Arch: linux/amd64 Experimental: false containerd: Version: 1.2.13 GitCommit: 7ad184331fa3e55e52b890ea95e65ba581ae3429 runc: Version: 1.0.0-rc10 GitCommit: dc9208a3303feef5b3839f4323d9beb36df0a9dd docker-init: Version: 0.18.0 GitCommit: fec3683配置鏡像加速

Docker 從 Docker Hub 拉取鏡像,因為是從國外獲取,所以速度較慢,會出現以下情況:

[root@localhost ~]# docker run hello-worldUnable to find image ’hello-world:latest’ locallydocker: Error response from daemon: Get https://registry-1.docker.io/v2/library/hello-world/manifests/latest: net/http: TLS handshake timeout.See ’docker run --help’.

可以通過配置國內鏡像源的方式,從國內獲取鏡像,提高拉取速度。這里介紹中國科學技術大學(LUG@USTC)的開源鏡像:https://docker.mirrors.ustc.edu.cn 和網易的開源鏡像:http://hub-mirror.c.163.com

USTC 是老牌的 Linux 鏡像服務提供者了,USTC 的 Docker 鏡像加速服務速度很快。USTC 和網易的優勢之一就是不需要注冊,屬于真正的公共服務。(也可以使用阿里等其他服務商的鏡像加速服務)

Docker 安裝及配置鏡像加速的實現

編輯文件 daemon.json 。

vi /etc/docker/daemon.json

在文件中輸入以下內容并保存。

{ 'registry-mirrors': ['http://hub-mirror.c.163.com', 'https://docker.mirrors.ustc.edu.cn']}

重新加載配置信息及重啟 Docker 服務。

# 重新加載某個服務的配置文件sudo systemctl daemon-reload# 重新啟動 dockersudo systemctl restart dockerhello-world

通過運行 hello-world 鏡像來驗證 Docker Engine 是否已正確安裝。

[root@localhost ~]# docker run hello-worldUnable to find image ’hello-world:latest’ locally # 本地找不到 hello-world 鏡像latest: Pulling from library/hello-world # 拉取最新版本的 hello-world 鏡像0e03bdcc26d7: Pull complete Digest: sha256:49a1c8800c94df04e9658809b006fd8a686cab8028d33cfba2cc049724254202Status: Downloaded newer image for hello-world:latest# 看到此消息表示您已正常安裝。Hello from Docker!This message shows that your installation appears to be working correctly.To generate this message, Docker took the following steps: 1. The Docker client contacted the Docker daemon. 2. The Docker daemon pulled the 'hello-world' image from the Docker Hub. (amd64) 3. The Docker daemon created a new container from that image which runs the executable that produces the output you are currently reading. 4. The Docker daemon streamed that output to the Docker client, which sent it to your terminal.To try something more ambitious, you can run an Ubuntu container with: $ docker run -it ubuntu bashShare images, automate workflows, and more with a free Docker ID: https://hub.docker.com/For more examples and ideas, visit: https://docs.docker.com/get-started/

docker run hello-world 命令執行流程圖如下。

Docker 安裝及配置鏡像加速的實現

通過以上步驟大家已完成 Docker 安裝的所有工作,接下來通過學習鏡像命令和容器命令更加熟悉 Docker 的使用。

到此這篇關于Docker 安裝及配置鏡像加速的實現的文章就介紹到這了,更多相關Docker 安裝及鏡像加速內容請搜索好吧啦網以前的文章或繼續瀏覽下面的相關文章希望大家以后多多支持好吧啦網!

標簽: Docker
相關文章:
主站蜘蛛池模板: 久久综合综合久久 | 美女图片131亚洲午夜 | 亚洲成av人影片在线观看 | 午夜影院a | 亚洲免费高清 | 国产精品久久久久久搜索 | 日本欧美久久久久免费播放网 | 边接电话边做国语高清对白 | 伊人青| 久久精品一区二区免费看 | 91原创视频在线观看 | 亚洲一级毛片免费观看 | 成人 在线欧美亚洲 | 亚洲国产日韩女人aaaaaa毛片在线 | 各种偷拍盗摄视频在线观看 | 成人在线不卡 | 一区二区高清在线 | 亚洲精品99久久一区二区三区 | 欧美成人怡红院在线观看 | 亚洲 自拍 另类 欧美 综合 | vvvv99日韩精品亚洲 | 美国一级毛片片aaa 美国一级毛片片aa成人 | 久草在线中文最新视频 | 女性无套免费网站在线看 | 成人免费影院 | 自拍理论片 | 操哭美女 | 男人天堂新地址 | 看久久久久毛片婷婷色 | 欧美a毛片| 国产精品三级a三级三级午夜 | 91香蕉网 | 国产一级视频免费 | 成人男男黄网色视频免费 | 99er精品| 久久亚洲欧洲日产国码 | 国产亚洲精品久久久久久午夜 | 亚洲国产cao | 欧美日韩高清不卡免费观看 | 全部免费国产潢色一级 | 国产精品漂亮美女在线观看 |