CentOS6下安装docker

53 篇文章 1 订阅
CentOS6下安装docker

官方文档要求Linux kernel至少3.8以上,且docker只能运行在64位的系统中。由于RHEL6和CentOS6的内核版本为2.6,因此必须要先升级内核。

    下面以CentOS6.5(64位)为例,介绍下docker安装步骤和使用方法:

一、升级内核(带aufs模块)

   1、yum安装带aufs模块的3.10内核(或到这里下载kernel手动安装:http://down.51cto.com/data/1903250)
cd /etc/yum.repos.d
wget http://www.hop5.in/yum/el6/hop5.repo
yum install kernel-ml-aufs kernel-ml-aufs-devel

   2、修改grub的主配置文件/etc/grub.conf,设置default=0,表示第一个title下的内容为默认启动的kernel(一般新安装的内核在第一个位置)。

   3、重启系统,这时候你的内核就成功升级了。
[root@localhost ~]# uname -r
3.10.5-3.el6.x86_64

   查看内核是否支持aufs:
[root@localhost ~]# grep aufs /proc/filesystems
nodev    aufs

二、安装docker
   1 Log into your machine as a user with sudo or root privileges.

   2 Make sure your existing yum packages are up-to-date.

   $ sudo yum update

   3 Run the Docker installation script.

   $ curl -sSL https://get.docker.com/ | sh


   This script adds the `docker.repo` repository and installs Docker.

   4 Start the Docker daemon.

   $ sudo service docker start

   5 Verify docker is installed correctly by running a test image in a container.

   $ sudo docker run hello-world

#############################################################

centos7下安装docker

uname -r

3.10.0-229.el7.x86_64

Install with yum

  1. Log into your machine as a user with sudo or root privileges.

  2. Make sure your existing yum packages are up-to-date.

    $ sudo yum update
    
  3. Add the yum repo.

    $ sudo 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
    
  4. Install the Docker package.

    $ sudo yum install docker-engine
    
  5. Start the Docker daemon.

    $ sudo service docker start
    
  6. Verify docker is installed correctly by running a test image in a container.

    $ sudo docker run hello-world

Install with the script

  1. Log into your machine as a user with sudo or root privileges.

  2. Make sure your existing yum packages are up-to-date.

    $ sudo yum update
    
  3. Run the Docker installation script.

    $ curl -sSL https://get.docker.com/ | sh
    

    This script adds the docker.repo repository and installs Docker.

  4. Start the Docker daemon.

    $ sudo service docker start
    
  5. Verify docker is installed correctly by running a test image in a container.

    $ sudo docker run hello-world


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值