Docker安裝配置鏡像加速器的實(shí)現(xiàn)
1.配置yum源倉(cāng)庫(kù)
[root@localhost ~]# curl -o docker-ce.repo https://mirrors.tuna.tsinghua.edu.cn/docker-ce/linux/centos/docker-ce.repo
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 1919 100 1919 0 0 2357 0 --:--:-- --:--:-- --:--:-- 2357
[root@localhost ~]# sed -i 's@https://download.docker.com@https://mirrors.tuna.tsinghua.edu.cn/docker-ce@g' docker-ce.repo
[root@localhost ~]# mv docker-ce.repo /etc/yum.repos.d/
[root@localhost ~]# dnf -y install docker-ce
2.安裝docker
[root@localhost ~]# dnf -y install docker-ce 正在更新 Subscription Management 軟件倉(cāng)庫(kù)。 無(wú)法讀取客戶身份 本系統(tǒng)尚未在權(quán)利服務(wù)器中注冊(cè)??墒褂?subscription-manager 進(jìn)行注冊(cè)。 Docker CE Stable - x86_64 18 kB/s | 56 kB 00:03 上次元數(shù)據(jù)過(guò)期檢查:0:00:01 前,執(zhí)行于 2024年09月11日 星期三 09時(shí)42分01秒。 依賴關(guān)系解決。 ============================================================================================================= 軟件包 架構(gòu) 版本 倉(cāng)庫(kù) 大小 ============================================================================================================= 安裝: docker-ce x86_64 3:27.2.1-1.el9 docker-ce-stable 27 M 安裝依賴關(guān)系: containerd.io x86_64 1.7.21-3.1.el9 docker-ce-stable 43 M docker-ce-cli x86_64 1:27.2.1-1.el9 docker-ce-stable 8.0 M 安裝弱的依賴: docker-buildx-plugin x86_64 0.16.2-1.el9 docker-ce-stable 14 M docker-ce-rootless-extras x86_64 27.2.1-1.el9 docker-ce-stable 4.4 M docker-compose-plugin x86_64 2.29.2-1.el9 docker-ce-stable 13 M 事務(wù)概要 ============================================================================================================= 安裝 6 軟件包 總下載:109 M 安裝大?。?25 M 下載軟件包: (1/6): docker-ce-27.2.1-1.el9.x86_64.rpm 7.0 MB/s | 27 MB 00:03 (2/6): containerd.io-1.7.21-3.1.el9.x86_64.rpm 7.6 MB/s | 43 MB 00:05 (3/6): docker-ce-cli-27.2.1-1.el9.x86_64.rpm 3.4 MB/s | 8.0 MB 00:02 (4/6): docker-ce-rootless-extras-27.2.1-1.el9.x86_64.rpm 4.8 MB/s | 4.4 MB 00:00 (5/6): docker-buildx-plugin-0.16.2-1.el9.x86_64.rpm 1.8 MB/s | 14 MB 00:07 (6/6): docker-compose-plugin-2.29.2-1.el9.x86_64.rpm 7.6 MB/s | 13 MB 00:01 ------------------------------------------------------------------------------------------------------------- 總計(jì) 14 MB/s | 109 MB 00:07 Docker CE Stable - x86_64 2.3 kB/s | 1.6 kB 00:00 導(dǎo)入 GPG 公鑰 0x621E9F35: Userid: "Docker Release (CE rpm) <docker@docker.com>" 指紋: 060A 61C5 1B55 8A7F 742B 77AA C52F EB6B 621E 9F35 來(lái)自: https://mirrors.tuna.tsinghua.edu.cn/docker-ce/linux/centos/gpg 導(dǎo)入公鑰成功 運(yùn)行事務(wù)檢查 事務(wù)檢查成功。 運(yùn)行事務(wù)測(cè)試 事務(wù)測(cè)試成功。 運(yùn)行事務(wù) 準(zhǔn)備中 : 1/1 安裝 : docker-compose-plugin-2.29.2-1.el9.x86_64 1/6 運(yùn)行腳本: docker-compose-plugin-2.29.2-1.el9.x86_64 1/6 安裝 : docker-buildx-plugin-0.16.2-1.el9.x86_64 2/6 運(yùn)行腳本: docker-buildx-plugin-0.16.2-1.el9.x86_64 2/6 安裝 : docker-ce-cli-1:27.2.1-1.el9.x86_64 3/6 運(yùn)行腳本: docker-ce-cli-1:27.2.1-1.el9.x86_64 3/6 安裝 : containerd.io-1.7.21-3.1.el9.x86_64 4/6 運(yùn)行腳本: containerd.io-1.7.21-3.1.el9.x86_64 4/6 安裝 : docker-ce-rootless-extras-27.2.1-1.el9.x86_64 5/6 運(yùn)行腳本: docker-ce-rootless-extras-27.2.1-1.el9.x86_64 5/6 安裝 : docker-ce-3:27.2.1-1.el9.x86_64 6/6 運(yùn)行腳本: docker-ce-3:27.2.1-1.el9.x86_64 6/6 驗(yàn)證 : containerd.io-1.7.21-3.1.el9.x86_64 1/6 驗(yàn)證 : docker-buildx-plugin-0.16.2-1.el9.x86_64 2/6 驗(yàn)證 : docker-ce-3:27.2.1-1.el9.x86_64 3/6 驗(yàn)證 : docker-ce-cli-1:27.2.1-1.el9.x86_64 4/6 驗(yàn)證 : docker-ce-rootless-extras-27.2.1-1.el9.x86_64 5/6 驗(yàn)證 : docker-compose-plugin-2.29.2-1.el9.x86_64 6/6 已更新安裝的產(chǎn)品。 已安裝: containerd.io-1.7.21-3.1.el9.x86_64 docker-buildx-plugin-0.16.2-1.el9.x86_64 docker-ce-3:27.2.1-1.el9.x86_64 docker-ce-cli-1:27.2.1-1.el9.x86_64 docker-ce-rootless-extras-27.2.1-1.el9.x86_64 docker-compose-plugin-2.29.2-1.el9.x86_64 完畢!
3.啟動(dòng)docker
1.啟動(dòng)docker自動(dòng)開(kāi)機(jī)
[root@localhost ~]# systemctl enable --now docker Created symlink /etc/systemd/system/multi-user.target.wants/docker.service → /usr/lib/systemd/system/docker.service.
2.查看docker的當(dāng)前狀態(tài)
[root@localhost ~]# systemctl status docker
● docker.service - Docker Application Container Engine
Loaded: loaded (/usr/lib/systemd/system/docker.service; enabled; preset: disabled)
Active: active (running) since Wed 2024-09-11 09:43:49 CST; 17s ago
TriggeredBy: ● docker.socket
Docs: https://docs.docker.com
Main PID: 35124 (dockerd)
Tasks: 10
Memory: 25.6M
CPU: 787ms
CGroup: /system.slice/docker.service
└─35124 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock
9月 11 09:43:48 localhost.localdomain systemd[1]: Starting Docker Application Container Engine...
9月 11 09:43:48 localhost.localdomain dockerd[35124]: time="2024-09-11T09:43:48.495682747+08:00" level=info >
9月 11 09:43:48 localhost.localdomain dockerd[35124]: time="2024-09-11T09:43:48.587274179+08:00" level=info >
9月 11 09:43:49 localhost.localdomain dockerd[35124]: time="2024-09-11T09:43:49.349750672+08:00" level=info >
...
4.配置鏡像加速器
1.進(jìn)入vim文字編輯器
vim /etc/docker/daemon.json
2.編輯內(nèi)容在阿里云官網(wǎng)中搜索并保存退出
{
"registry-mirrors": ["https://8r73devx.mirror.aliyuncs.com"]
}
5.重啟docker
systemctl restart docker
6.查看系統(tǒng)版本信息
[root@localhost ~]# docker version Client: Docker Engine - Community Version: 27.2.1 API version: 1.47 Go version: go1.22.7 Git commit: 9e34c9b Built: Fri Sep 6 12:09:42 2024 OS/Arch: linux/amd64 Context: default Server: Docker Engine - Community Engine: Version: 27.2.1 API version: 1.47 (minimum version 1.24) Go version: go1.22.7 Git commit: 8b539b8 Built: Fri Sep 6 12:07:57 2024 OS/Arch: linux/amd64 Experimental: false containerd: Version: 1.7.21 GitCommit: 472731909fa34bd7bc9c087e4c27943f9835f111 runc: Version: 1.1.13 GitCommit: v1.1.13-0-g58aa920 docker-init: Version: 0.19.0 GitCommit: de40ad0
7.運(yùn)行docker
[root@localhost ~]# docker run hello-world
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 bash
Share 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/
[root@localhost ~]#
到此這篇關(guān)于Dockers安裝配置鏡像加速器的實(shí)現(xiàn)的文章就介紹到這了,更多相關(guān)Dockers安裝配置鏡像加速器內(nèi)容請(qǐng)搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!
相關(guān)文章
詳解Docker的持久化存儲(chǔ)和數(shù)據(jù)共享
這篇文章主要介紹了詳解Docker的持久化存儲(chǔ)和數(shù)據(jù)共享,小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過(guò)來(lái)看看吧2018-08-08
在OpenWrt設(shè)備上搭建Docker環(huán)境的完整方案
OpenWrt 作為一個(gè)高度可定制的嵌入式 Linux 發(fā)行版,其模塊化設(shè)計(jì)為 Docker 容器化部署提供了可能性,將 Docker 引入 OpenWrt 環(huán)境,能夠帶來(lái)許多優(yōu)勢(shì),所以本文給大家分享了在 OpenWrt 設(shè)備上搭建 Docker 環(huán)境的完整方案,需要的朋友可以參考下2025-04-04
docker部署Trilium?Notes和cpolar,實(shí)現(xiàn)遠(yuǎn)程在線協(xié)作(圖文教程)
Trilium?Notes?是一款層次化筆記工具,能構(gòu)建大型個(gè)人知識(shí)庫(kù),支持樹(shù)形結(jié)構(gòu)、Markdown?編輯、雙向鏈接和加密等功能,本文講述Trilium?Notes的中文版如何在Linux環(huán)境使用docker本地部署,并結(jié)合cpolar內(nèi)網(wǎng)穿透工具配置公網(wǎng)地址,輕松實(shí)現(xiàn)遠(yuǎn)程在線協(xié)作的詳細(xì)教程2026-01-01
詳解docker pull下來(lái)的鏡像存儲(chǔ)在哪里
這篇文章主要介紹了詳解docker pull下來(lái)的鏡像存儲(chǔ)在哪里,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧2020-12-12
同一宿主機(jī)內(nèi)不同docker間通訊的實(shí)現(xiàn)示例
本文主要介紹了同一宿主機(jī)內(nèi)不同docker間通訊的實(shí)現(xiàn)示例,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧2025-11-11
快速修改運(yùn)行中的docker容器端口映射的三種方式
當(dāng)docker?start運(yùn)行容器后并沒(méi)有提供一個(gè)-p選項(xiàng)或設(shè)置,讓你修改指定端口映射規(guī)則,那么這種情況我們?cè)撛趺刺幚砟?今天教如何修改運(yùn)行中的docker容器的端口映射,感興趣的朋友跟隨小編一起看看吧2023-01-01
Docker構(gòu)建kubectl鏡像的實(shí)現(xiàn)步驟
這篇文章主要介紹了Docker構(gòu)建kubectl鏡像的實(shí)現(xiàn)步驟,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧2021-01-01

