• 阿里云Docker配置镜像加速器


    镜像配置

    image-20220508205850357

    每一个开发者都有一个唯一的加速器地址

    安装/升级Docker客户端

    推荐安装1.10.0以上版本的Docker客户端,参考文档docker-ce

    配置镜像加速器

    针对Docker客户端版本大于 1.10.0 的用户

    您可以通过修改daemon配置文件/etc/docker/daemon.json来使用加速器

    sudo mkdir -p /etc/docker
    sudo tee /etc/docker/daemon.json <<-'EOF'
    {
      "registry-mirrors": ["https://ks0realz.mirror.aliyuncs.com"]
    }
    EOF
    sudo systemctl daemon-reload
    sudo systemctl restart docker
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7

    重新启动docker

    验证

    docker run hello-word
    
    • 1

    如果本地没有hello-word这个镜像,就会下载一个hello-word镜像,并且在本地容器内运行

    而且输出提示信息后,hello-word就会停止运行,容器自动终止

    run做了些什么
    1. 开始docker先在本机中寻找镜像以该镜像为模板生产容器实例运行
    2. 如果没有的话就去docker hub上查找镜像,找到就下载到本地并且以该镜像为模板生产容器实例运行
    3. 如果没有找到就报错,返回错误
    为什么docker比虚拟机快

    因为docker不需要像hypervisor(虚拟机)实现硬件实例化,运行在docker容器上的程序直接使用的都是实例物理机的硬件资源,因此在CPU、内存利用率上docker更有效率

    hello-word案例

    root@ubuntu:/hyerledgerFabric# docker run hello-world
    Unable to find image 'hello-world:latest' locally
    latest: Pulling from library/hello-world
    2db29710123e: Pull complete 
    Digest: sha256:2498fce14358aa50ead0cc6c19990fc6ff866ce72aeb5546e1d59caac3d0d60f
    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/
    
    root@ubuntu:/hyerledgerFabric# 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/
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43
    • 44
    • 45
    • 46
    • 47
    • 48
    • 49

    https://hub.docker.com/

  • 相关阅读:
    【CSDN竞赛】第九期解题报告
    我们该如何运营Facebook账号呢?
    关于while和do-while结构
    AI问诊逐渐取代医生是不是伪命题?实测国内外医疗专用大模型
    搞定ESD(二):ESD干扰机理分析
    数仓项目拉链表
    SuperMap 是个什么鬼
    分享从零开始学习网络设备配置--2.1 交换机基本配置
    安装cygwin软件
    linux网络编程之socket,bind,listen,connect,accept
  • 原文地址:https://blog.csdn.net/weixin_54707168/article/details/126705960