• 阿里云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/

  • 相关阅读:
    岁月
    JVM 对象引用类型
    转行程序员,现实中真的容易吗?
    27、用户操作srv、web服务实现
    腾讯云服务器如何手动安装node.js环境?
    JavaScript函数中this的指向问题讨论(普通函数和箭头函数)
    P3853 [TJOI2007]路标设置——二分答案
    手机怎么压缩图片?通过三种压缩操作
    绘图系统三:支持散点图、极坐标和子图绘制
    [MySQL] Linux下安装mysql8(基于RPM离线安装和yum方式安装)
  • 原文地址:https://blog.csdn.net/weixin_54707168/article/details/126705960