zoukankan      html  css  js  c++  java
  • centos7上安装docker社区版

    container(容器)

    docker(集装箱)

    容器的优点

    1、 启动速度快

    2、 节省资源

    3、 兼容性高

    保证机器正常上网

    #ping www.baidu.com

    CPU需要支持虚拟化

    # grep -E 'svm|vmx' /proc/cpuinfo

    找到flags部分,如果其中输出有SVM或VMX,表明CPU支持虚拟化技术:
    ==》 svm - Secure virtual machine, AMD的虚拟化技术AMD-V
    ==》 vmx - Intel的虚拟化技术Intel-VT

    [root@localhost ~]# grep -E 'svm|vmx' /proc/cpuinfo
    flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts mmx fxsr sse sse2 ss ht syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts nopl xtopology tsc_reliable nonstop_tsc aperfmperf eagerfpu pni pclmulqdq vmx ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm 3dnowprefetch tpr_shadow vnmi ept vpid fsgsbase tsc_adjust bmi1 avx2 smep bmi2 invpcid rdseed adx smap xsaveopt xsavec xgetbv1 dtherm ida arat pln pts hwp hwp_notify hwp_act_window hwp_epp
    flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts mmx fxsr sse sse2 ss ht syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts nopl xtopology tsc_reliable nonstop_tsc aperfmperf eagerfpu pni pclmulqdq vmx ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm 3dnowprefetch tpr_shadow vnmi ept vpid fsgsbase tsc_adjust bmi1 avx2 smep bmi2 invpcid rdseed adx smap xsaveopt xsavec xgetbv1 dtherm ida arat pln pts hwp hwp_notify hwp_act_window hwp_epp

    安装 yum-utils,它提供了 yum-config-manager,可用来管理yum源

    # yum install yum-utils -y

    添加docker网络yum源docker-ce.repo

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

    配置网络yum源

    http://mirrors.163.com/.help/centos.html

    使用wget下载163的源

    #wget http://mirrors.163.com/.help/CentOS6-Base-163.repo

    重新创建缓存文件

    三个随便选一个执行即可

    # yum makecache

    #yum makecache fast

    # yum clean all

    注意:添加完网络yum源后,执行以下命令

    #rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

    安装docker 

    # yum install docker-ce

    报错信息

    Total                                                          4.9 MB/s |  72 MB  00:00:14     
    Retrieving key from http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6
    Importing GPG key 0xC105B9DE:
     Userid     : "CentOS-6 Key (CentOS 6 Official Signing Key) <centos-6-key@centos.org>"
     Fingerprint: c1da c52d 1664 e8a4 386d ba43 0946 fca2 c105 b9de
     From       : http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6
    Is this ok [y/N]: y
    
    
    Public key for libcgroup-0.41-20.el7.x86_64.rpm is not installed
    
    
     Failing package is: libcgroup-0.41-20.el7.x86_64
     GPG Keys are configured as: http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6

     解决办法

    #rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

    再次安装

    # yum install docker-ce

    确认docker服务的安装

    # yum list installed | grep docker

    [root@localhost ~]# yum list installed | grep docker
    docker.x86_64                        2:1.13.1-94.gitb2f74b2.el7.centos @extrs   
    docker-client.x86_64                 2:1.13.1-94.gitb2f74b2.el7.centos @extrs   
    docker-common.x86_64                 2:1.13.1-94.gitb2f74b2.el7.centos @extrs 

    开启docker并查看版本

    # systemctl start docker

    # docker version

    docker安装完成

    附上安装源

    163的源

    centos-base.repo

    [base]
    name=CentOS-$releasever - Base - 163.com
    baseurl=http://mirrors.163.com/centos/7/os/x86_64/
    gpgcheck=0
    
    [updates]
    name=CentOS-$releasever - Updates - 163.com
    baseurl=http://mirrors.163.com/centos/7/updates/x86_64/
    gpgcheck=0
    
    [extras]
    name=CentOS-$releasever - Extras - 163.com
    baseurl=http://mirrors.163.com/centos/7/extras/x86_64/
    gpgcheck=0

     docker-ce.repo

    [docker-ce-stable]
    name=Docker CE Stable - $basearch
    baseurl=https://mirrors.aliyun.com/docker-ce/linux/centos/7/$basearch/stable
    enabled=1
    gpgcheck=0
    #gpgkey=https://mirrors.aliyun.com/docker-ce/linux/centos/gpg

    参考博客

    centos7上安装docker

    https://www.cnblogs.com/yufeng218/p/8370670.html

    https://blog.csdn.net/xixiworld/article/details/71438794

    CentOS7 配置网络和yum源

    https://blog.csdn.net/weixin_41782053/article/details/80524515

    centos7下yum安装docker报找不到可用包docker

    https://blog.csdn.net/qq751470431/article/details/77771786

  • 相关阅读:
    一些网站后台模板源码分析 Particleground.js 验证码
    C# 接口的作用浅谈举例(转)
    C# 批量修改文件名
    12306抢票软件相关接口以及数据格式
    StackExChange.Redis for C# 中文文档
    asp.net core 3+ 修改view后自动重新编译运行
    ASP.NET MVC https全局配置
    c#DateTime与unix时间戳互相转换
    mongodb创建管理员用户
    Office365激活方法(无需密钥)
  • 原文地址:https://www.cnblogs.com/djlsunshine/p/10178312.html
Copyright © 2011-2022 走看看