美文网首页Docker容器
Centos 7 下安装 Docker

Centos 7 下安装 Docker

作者: 567f84810acc | 来源:发表于2020-01-09 13:50 被阅读0次

    参考文档

    机器配置

    Architecture:          x86_64
    CPU op-mode(s):        32-bit, 64-bit
    Byte Order:            Little Endian
    CPU(s):                48
    On-line CPU(s) list:   0-47
    Thread(s) per core:    2
    Core(s) per socket:    12
    Socket(s):             2
    NUMA node(s):          2
    Vendor ID:             GenuineIntel
    CPU family:            6
    Model:                 63
    Model name:            Intel(R) Xeon(R) CPU E5-2678 v3 @ 2.50GHz
    Stepping:              2
    CPU MHz:               1201.953
    CPU max MHz:           3300.0000
    CPU min MHz:           1200.0000
    BogoMIPS:              4999.79
    Virtualization:        VT-x
    L1d cache:             32K
    L1i cache:             32K
    L2 cache:              256K
    L3 cache:              30720K
    NUMA node0 CPU(s):     0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46
    NUMA node1 CPU(s):     1,3,5,7,9,11,13,15,17,19,21,23,25,27,29,31,33,35,37,39,41,43,45,47
    Flags:                 fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 fma cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm ida arat epb pln pts dtherm tpr_shadow vnmi flexpriority ept vpid fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid cqm xsaveopt cqm_llc cqm_occup_llc
    
    - free -h
                  total        used        free      shared  buff/cache   available
    Mem:            62G         34G         16G         10M         11G         28G
    Swap:          8.0G        219M        7.8G
    

    安装

     #Install Docker CE
    ## Set up the repository
    ### Install required packages.
    yum install yum-utils device-mapper-persistent-data lvm2
    
    ### Add Docker repository.
    yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
    
    ## Install Docker CE.
    yum update && yum install containerd.io-1.2.10   docker-ce-19.03.4 docker-ce-cli-19.03.4
    
    ## Create /etc/docker directory.
    mkdir /etc/docker
    
    # Setup daemon.
    # https://docs.docker.com/config/daemon/
    cat > /etc/docker/daemon.json 
    --------------------
    {
      "exec-opts": ["native.cgroupdriver=systemd"],
      "log-driver": "json-file",
      "log-opts": {
        "max-size": "100m"
      },
      "storage-driver": "overlay2",
      "storage-opts": [
        "overlay2.override_kernel_check=true"
      ]
    }
    --------------------
    mkdir -p /etc/systemd/system/docker.service.d
    
    # Restart Docker
    systemctl daemon-reload
    systemctl restart docker
    

    K8s 涉及

    modprobe overlay
    modprobe br_netfilter
    
    # Setup required sysctl params, these persist across reboots.
    cat > /etc/sysctl.d/99-kubernetes-cri.conf <<EOF
    net.bridge.bridge-nf-call-iptables  = 1
    net.ipv4.ip_forward                 = 1
    net.bridge.bridge-nf-call-ip6tables = 1
    EOF
    
    sysctl --system
    
    
    >>>
    
    
    
    # Install prerequisites
    yum-config-manager --add-repo=https://cbs.centos.org/repos/paas7-crio-115-release/x86_64/os/
    
    # Install CRI-O
    yum install --nogpgcheck cri-o
    
    systemctl daemon-reload
    systemctl start crio
    
    
    >>>
    ###  containerd用作CRI运行时的必要步骤
    
    cat > /etc/modules-load.d/containerd.conf <<EOF
    overlay
    br_netfilter
    EOF
    
    >>>
    
    # Install containerd
    ## Set up the repository
    ### Install required packages
    yum install yum-utils device-mapper-persistent-data lvm2
    
    ### Add docker repository
    yum-config-manager \
        --add-repo \
        https://download.docker.com/linux/centos/docker-ce.repo
    
    ## Install containerd
    yum update && yum install containerd.io
    
    # Configure containerd
    mkdir -p /etc/containerd
    containerd config default > /etc/containerd/config.toml
    
    # Restart containerd
    systemctl restart containerd
    
    

    Stat

    # systemctl status docker.service
    ● docker.service - Docker Application Container Engine
       Loaded: loaded (/usr/lib/systemd/system/docker.service; disabled; vendor preset: disabled)
       Active: active (running) since Thu 2019-12-19 14:54:57 CST; 11s ago
         Docs: https://docs.docker.com
     Main PID: 13067 (dockerd)
        Tasks: 36
       Memory: 57.1M
       CGroup: /system.slice/docker.service
               └─13067 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock
    

    相关文章

      网友评论

        本文标题:Centos 7 下安装 Docker

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