Docker镜像换源

文章目录

  • Docker镜像换源
    • [1 更新Docker镜像源](#1 更新Docker镜像源)
    • [2 重启Docker服务](#2 重启Docker服务)
    • [3 验证换源是否成功](#3 验证换源是否成功)

Docker镜像换源

环境: Ubuntu22.04

由于各种网络政策,在国内访问DockerHub速度会非常缓慢,大家一般都会采取更换镜像源的方式来进行加速。

1 更新Docker镜像源

直接将下列文本粘贴到终端中,然后回车运行即可。

sh 复制代码
pzs@pzs-jammy:~$ sudo tee /etc/docker/daemon.json << 'EOF'
{
    "registry-mirrors": [
    "https://docker.m.daocloud.io",
    "https://docker.imgdb.de",
    "https://docker-0.unsee.tech",
    "https://docker.hlmirror.com",
    "https://cjie.eu.org"
    ]
}
EOF

注:上面的镜像不一定能够一直使用,如果不能使用,请自行找其他镜像源!!!

2 重启Docker服务

sh 复制代码
pzs@pzs-jammy:~$ sudo systemctl daemon-reload 
pzs@pzs-jammy:~$  sudo systemctl restart docker

3 验证换源是否成功

sh 复制代码
pzs@pzs-jammy:~$ sudo docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
d5e71e642bf5: Download complete 
4f55086f7dd0: Pull complete 
Digest: sha256:5e23090353324d887c48ad5e5c56d294eab81588df9605b07d1afe895f9cc8f8
Status: 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 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/
相关推荐
对象存储与RustFS17 小时前
网盘限速逼你开会员?用 RustFS 自己搭一个不限速的“私人网盘
服务器·后端·docker
众壹新能源科技19 小时前
逆变器自带无功不够用,加装5MVar SVG后功率因数从0.85回到0.99
运维·人工智能·自动化
..Dauntless..19 小时前
【Linux】一切皆文件和缓冲区
linux·运维·服务器
QMCY_jason19 小时前
x86 ubuntu2204 无gui 安装 openeuler 2203 aarch64版本
linux·运维·服务器
重生之小比特20 小时前
【Linux系统】12 进程程序替换 自定义Shell 命令行解释器
linux·运维·服务器
考拉讲支付20 小时前
母婴亲子服务平台分账架构设计:多场景多方分账与合规清结算实践
大数据·运维·人工智能·微信小程序·架构·微信公众平台
LateFrames20 小时前
“场控软件” 如何容错与运维
运维·容错·led大屏·播控系统·场控软件
あ-20 小时前
CubeSandBox配置CubeMaster CPU 超分
linux·运维·服务器
程序员老赵20 小时前
Docker 部署 Filestash:轻松搭建浏览器文件管理平台
前端·docker·开源
艾伦_耶格宇20 小时前
【DOCKER容器实战】-5 Docker容器镜像的构建
运维·docker·容器