zoukankan      html  css  js  c++  java
  • 使用阿里云对docker拉取镜像加速

    使用docker的时候,总是需要去search镜像,使用国外的源下载太慢,还有诸多的限制,无意中发现可以使用阿里云进行加速,实测有用,废话少说,操作如下:

    1.打开阿里云控制台,没有的可以用淘宝账号或者支付宝账号直接登录

    https://cr.console.aliyun.com/cn-hangzhou/instances/mirrors

    打开容器镜像服务,镜像加速器,复制加速地址后,按照第二个红框所示,完成配置。

    2.重启docker

    systemctl daemon-reload

    systemctl restart docker

    OK!加速完成,嗖嗖嗖!!!

    tee /etc/docker/daemon.json <<-'EOF'
    {
      "registry-mirrors": ["https://c8it25aj.mirror.aliyuncs.com"]
    }
    EOF
    systemctl daemon-reload && systemctl restart docker

    发现一个小bug: 修改daemon.json文件导致docker不能启动

    网上大部分说是daemon.json的文件配置的有问题,有的说是docker软件包的问题,可实际上是没有问题的,最后通过修改/usr/lib/systemd/system/docker.service文件来解决了

    [Unit]
    Description=Docker Application Container Engine
    Documentation=https://docs.docker.com
    After=network-online.target firewalld.service
    Wants=network-online.target
    
    [Service]
    Type=notify
    # the default is not to use systemd for cgroups because the delegate issues still
    # exists and systemd currently does not support the cgroup feature set required
    # for containers run by docker
    
    # docker-18.03
    ExecStart=/usr/bin/dockerd --data-root=/data/docker 删除掉这里的地址,这里会导致源与ali源冲突
    
    ExecReload=/bin/kill -s HUP $MAINPID
    # Having non-zero Limit*s causes performance problems due to accounting overhead
    # in the kernel. We recommend using cgroups to do container-local accounting.
    LimitNOFILE=infinity
    LimitNPROC=infinity
    LimitCORE=infinity
    # Uncomment TasksMax if your systemd version supports it.
    # Only systemd 226 and above support this version.
    #TasksMax=infinity
    TimeoutStartSec=0
    # set delegate yes so that systemd does not reset the cgroups of docker containers
    Delegate=yes
    # kill only the docker process, not all processes in the cgroup
    KillMode=process
    # restart the docker process if it exits prematurely
    "/usr/lib/systemd/system/docker.service" 36L, 1183C

      

  • 相关阅读:
    CSS知识(18---21.CSS完毕)
    CSS 知识(13---)
    CSS编辑知识 ( 1---12 )
    CSS 选择器
    前端CSS
    修建泳池的题解
    2020-3-7模拟赛题解
    奶牛排队的题解
    数的拆分的题解
    青蛙王子的题解
  • 原文地址:https://www.cnblogs.com/xiaoyuxixi/p/11219823.html
Copyright © 2011-2022 走看看