1.配置阿里云镜像加速服务。
    进入 https://cr.console.aliyun.com/cn-qingdao/instances/mirrors
    在虚拟机centos的目录下执行命令

    1. sudo tee /etc/docker/daemon.json <<-'EOF'
    2. {
    3. "registry-mirrors": ["https://3mnd11z0.mirror.aliyuncs.com"]
    4. }
    5. EOF

    https://3mnd11z0.mirror.aliyuncs.com 是我的加速地址,每个人的地址不同。

    1. sudo systemctl daemon-reload 重载文件
    2. sudo systemctl restart docker 重启docker

    1.Docker用镜像创建了容器并运行,
    docker run hello-world

    1. [root@test docker]# docker run hello-world
    2. Unable to find image 'hello-world:latest' locally //找不到最新的镜像
    3. latest: Pulling from library/hello-world //从仓库中拉取 hello-world镜像
    4. 0e03bdcc26d7: Pull complete
    5. Digest: sha256:1a523af650137b8accdaed439c17d684df61ee4d74feac151b5b337bd29e7eec
    6. Status: Downloaded newer image for hello-world:latest
    7. Hello from Docker!
    8. This message shows that your installation appears to be working correctly.
    9. To generate this message, Docker took the following steps:
    10. 1. The Docker client contacted the Docker daemon.
    11. 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
    12. (amd64)
    13. 3. The Docker daemon created a new container from that image which runs the
    14. executable that produces the output you are currently reading.
    15. 4. The Docker daemon streamed that output to the Docker client, which sent it
    16. to your terminal.
    17. To try something more ambitious, you can run an Ubuntu container with:
    18. $ docker run -it ubuntu bash
    19. Share images, automate workflows, and more with a free Docker ID:
    20. https://hub.docker.com/
    21. For more examples and ideas, visit:
    22. https://docs.docker.com/get-started/

    image.png