美文网首页
CentOS7安装Docker CE(国内源)

CentOS7安装Docker CE(国内源)

作者: clam314 | 来源:发表于2020-12-15 16:37 被阅读0次

    1、添加Docker国内源

    1.1、安装yum管理工具

    $ sudo yum install -y yum-utils  device-mapper-persistent-data lvm2
    

    1.2、安装国内源

    $sudo yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
    

    点击链接不能下载,则需要替换其他国内源:
    http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo

    2、安装Docker CE

    2.1安装docker ce最新版

    $ sudo yum install docker-ce docker-ce-cli containerd.io
    

    2.2添加国内镜像创库

    修改/etc/docker/daemon.json(没有则创建,有则直接修改)
    创建daemon.json(发生过不创建docker文件夹时在vi保存失败,创建docker文件夹mkdir /etc/docker

    $vi /etc/docker/daemon.json
    

    修改daemon.json

    {
    
      "registry-mirrors": ["https://aacfpfx3.mirror.aliyuncs.com","http://registry.docker-cn.com","http://docker.mirrors.ustc.edu.cn","http://hub-mirror.c.163.com"]
    
    }
    

    配置刷新一下

    $ sudo systemctl daemon-reload
    

    重启docker生效

    $ sudo systemctl restart docker
    

    3、启动docker和设置开机启动

    启动

    $ sudo systemctl start docker
    

    设置开机启动

    $ sudo systemctl enable docker
    

    4、查看docker信息

    $ docker info
    
    Client:
     Context:    default
     Debug Mode: false
     Plugins:
      app: Docker App (Docker Inc., v0.9.1-beta3)
      buildx: Build with BuildKit (Docker Inc., v0.5.1-docker)
    
    Server:
     Containers: 0
      Running: 0
      Paused: 0
      Stopped: 0
     Images: 0
     Server Version: 20.10.2
     Storage Driver: overlay2
      Backing Filesystem: extfs
      Supports d_type: true
      Native Overlay Diff: true
     Logging Driver: json-file
     Cgroup Driver: cgroupfs
     Cgroup Version: 1
     Plugins:
      Volume: local
      Network: bridge host ipvlan macvlan null overlay
      Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
     Swarm: inactive
     Runtimes: runc io.containerd.runc.v2 io.containerd.runtime.v1.linux
     Default Runtime: runc
     Init Binary: docker-init
     containerd version: 269548fa27e0089a8b8278fc4fc781d7f65a939b
     runc version: ff819c7e9184c13b7c2607fe6c30ae19403a7aff
     init version: de40ad0
     Security Options:
      seccomp
       Profile: default
     Kernel Version: 3.10.0-1127.19.1.el7.x86_64
     Operating System: CentOS Linux 7 (Core)
     OSType: linux
     Architecture: x86_64
     CPUs: 1
     Total Memory: 1.795GiB
     Name: VM-8-3-centos
     ID: 64V3:NGZV:CTTC:6U6I:WC3V:3L4D:2SMO:XMX3:QIPJ:ZW2R:6BSV:VPZA
     Docker Root Dir: /var/lib/docker
     Debug Mode: false
     Registry: https://index.docker.io/v1/
     Labels:
     Experimental: false
     Insecure Registries:
      127.0.0.0/8
     Registry Mirrors:
      https://aacfpfx3.mirror.aliyuncs.com/
      http://registry.docker-cn.com/
      http://docker.mirrors.ustc.edu.cn/
      http://hub-mirror.c.163.com/
     Live Restore Enabled: false
    

    相关文章

      网友评论

          本文标题:CentOS7安装Docker CE(国内源)

          本文链接:https://www.haomeiwen.com/subject/ebywgktx.html