美文网首页
CentOS6.5 安装Docker

CentOS6.5 安装Docker

作者: 小乖心塞 | 来源:发表于2017-03-16 17:23 被阅读4833次

    CentOS6.5 升级内核

    centos初始内核为2.6 ,用命令uname -r

    [root@bogon ~]# uname -r
    2.6.32-358.el6.x86_64
    
    • 在yum的ELRepo源中,有 m ain l ine(3.13.1)、 l ong- t erm(3.10.28)这2个内核版本,考虑到long-term更稳定,会长期更新,所以选择这个版本。
    1. 导入public key :
      rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
    2. 安装ELRepo到CentOS-6.5中:
      rpm -ivh http://www.elrepo.org/elrepo-release-6-5.el6.elrepo.noarch.rpm
    3. 安装 kernel-lt(lt=long-term):
      yum --enablerepo=elrepo-kernel install kernel-lt -y
      或者安装kernel-ml(ml=mainline):
      yum --enablerepo=elrepo-kernel install kernel-ml -y
    4. 因为之前我配置阿里的yum源,所以在安装kernel-lt时一直报错:Error: Cannot retrieve repository metadata (repomd.xml) for repository: epel. Please verify its path and try again,元数据地址发生改变,不能获取数据。所以将epel.repo中的enabled=1改为enabled=0
    5. 编辑grub.conf文件,修改Grub引导顺序,确认刚安装好的内核在哪个位置,然后设置default值(从0开始),一般新安装的内核在第一个位置,所以设置default=0。
      vi /etc/grub.conf
    #boot=/dev/sda
    default=0
    timeout=5
    splashimage=(hd0,0)/grub/splash.xpm.gz
    hiddenmenu
    title CentOS (4.10.3-1.el6.elrepo.x86_64)
            root (hd0,0)
            kernel /vmlinuz-4.10.3-1.el6.elrepo.x86_64 ro root=UUID=6f659055-ea8a-4ac1-9421-e91eb44ea7e0 rd_NO_LUKS rd_NO_LVM LANG=en_US.UTF-8 rd_NO_MD SYSFONT=latarcyrheb-sun16 crashkernel=auto  KEYBOARDTYPE=pc KEYTABLE=us rd_NO_DM rhgb quiet
            initrd /initramfs-4.10.3-1.el6.elrepo.x86_64.img
    title CentOS (2.6.32-358.el6.x86_64)
            root (hd0,0)
            kernel /vmlinuz-2.6.32-358.el6.x86_64 ro root=UUID=6f659055-ea8a-4ac1-9421-e91eb44ea7e0 rd_NO_LUKS rd_NO_LVM LANG=en_US.UTF-8 rd_NO_MD SYSFONT=latarcyrheb-sun16 crashkernel=auto  KEYBOARDTYPE=pc KEYTABLE=us rd_NO_DM rhgb quiet
    
    1. 重启
      init 6
    2. 重新查看内核
      uname -r
    [root@bogon ~]# uname -r
    4.10.3-1.el6.elrepo.x86_64
    
    1. 大功告成O(∩_∩)O~

    CentOS6.5 安装Docker

    1. 更新yum
      yum update
    2. 生成docker.repo
    tee /etc/yum.repos.d/docker.repo <<-'EOF'
    [dockerrepo]
    name=Docker Repository
    baseurl=https://yum.dockerproject.org/repo/main/centos/$releasever/
    enabled=1
    gpgcheck=1
    gpgkey=https://yum.dockerproject.org/gpg
    EOF
    

    tee 读取标准输入的数据,并将其内容输出成文件。

    1. yum安装docker
    yum install docker-engine
    
    docker安装
    1. 查看版本
    [root@bogon yum.repos.d]# docker --version
    Docker version 1.7.1, build 786b29d
    
    1. 启动docker服务
      service docker start
    2. 检查docker状态
      service docker status
    3. 在线查找镜像:docker search [镜像名]
      docker search tomcat
      start代表受欢迎程度。OFFICIAL代表官方版本
    [root@bogon yum.repos.d]# docker search tomcat
    NAME                           DESCRIPTION                                     STARS     OFFICIAL   AUTOMATED
    tomcat                         Apache Tomcat is an open source implementa...   1235      [OK]
    dordoka/tomcat                 Ubuntu 14.04, Oracle JDK 8 and Tomcat 8 ba...   33                   [OK]
    davidcaste/alpine-tomcat       Apache Tomcat 7/8 using Oracle Java 7/8 wi...   17                   [OK]
    cloudesire/tomcat              Tomcat server, 6/7/8                            13                   [OK]
    andreptb/tomcat                Debian Jessie based image with Apache Tomc...   6                    [OK]
    openweb/oracle-tomcat          A fork off of Official tomcat image with O...   5                    [OK]
    fbrx/tomcat                    Minimal Tomcat image based on Alpine Linux      4                    [OK]
    kieker/tomcat                                                                  2                    [OK]
    picoded/tomcat                 tomcat 8 with java 8, and MANAGER_USER / M...   1                    [OK]
    abzcoding/tomcat-redis         a tomcat container with redis as session m...   1                    [OK]
    cloudunit/tomcat-9             tomcat-9                                        1                    [OK]
    camptocamp/tomcat-logback      Docker image for tomcat with logback integ...   1                    [OK]
    bitnami/tomcat                 Bitnami Tomcat Docker Image                     1                    [OK]
    antoineco/tomcat-mod_cluster   Apache Tomcat with JBoss mod_cluster            1                    [OK]
    charlycoste/tomcat             Debian based Tomcat (don't use it, this is...   0                    [OK]
    cheewai/tomcat                 Tomcat and Oracle JRE in docker                 0                    [OK]
    phpmentors/tomcat-app          Tomcat application image using Maven            0                    [OK]
    davidcaste/debian-tomcat       Yet another Debian Docker image for Tomcat...   0                    [OK]
    inspectit/tomcat               Tomcat with inspectIT                           0                    [OK]
    muicoder/tomcat                tomcat                                          0                    [OK]
    dianplus/tomcat                Tomcat base image maintained by dianjia.io.     0                    [OK]
    antoineco/tomcat               Extra OS variants for the official Tomcat ...   0                    [OK]
    blueur/tomcat                  Tomcat with the possibility to set the use...   0                    [OK]
    steigr/tomcat                  Apache Tomcat based on Alpine Linux with l...   0                    [OK]
    oriaks/tomcat                  Tomcat                                          0                    [OK]
    
    1. 拉取镜像:docker pull [镜像名称[:版本]]
      docker pull tomcat:7

    相关文章

      网友评论

          本文标题:CentOS6.5 安装Docker

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