docker 配置 阿里云镜像加速器

1、简介               

  为什么使用阿里云镜像加速器?

               通常在国内使用Docker,是需要从Docker官网去拉取镜像的,但是官网是在国外的, 所以下载非常慢,或者都下载不了,总是报timeout连接失败错误,因此需要配置镜像的下载,

              这个是docker操作首先要做的事情,通常使用以下两种方式。

2、、登录 阿里云 

https://promotion.aliyun.com

注册或使用 淘宝账号登录

docker 配置 阿里云镜像加速器

3、主机上 创建 文件 vi /etc/docker/daemon.json

黏贴下内容

{
  "registry-mirrors": ["https://jupy3f13.mirror.aliyuncs.com"]
}

4、重启 docker

daemon-reload
restart docker

5、验证 加速器地址释放修改 

docker info

docker 配置 阿里云镜像加速器

 6、执行 hello-world

docker run hello-world
docker run hello-world
Unable to find image ‘hello-world:latest‘ locally # 本地没有 hello-world 镜像,需要到阿里云镜像下载
latest: Pulling from library/hello-world
0e03bdcc26d7: Pull complete 
Digest: sha256:6a65f928fb91fcfbc963f7aa6d57c8eeb426ad9a20c7ee045538ef34847f44f1
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/

7 、docker 执行流程

 docker 配置 阿里云镜像加速器

相关推荐