在RedHat/CentOS下安装Docker(不升级内核)

背景linux

因为内核版本问题,最初仅Ubuntu能够较好的支持Docker。不过,因为RedHat系列OS(REHL、CentOS)是目前主流的Linux服务器操做系统,因此令RedHat系列OS支持Docker颇有必要。目前Docker和RedHat已经展开深刻合做,并在2013年年末推出了能够在RedHat系列OS上运行的Docker0.7。docker

目前有一些博客介绍了如何在CentOS上安装Docker,例如http://www.linuxidc.com/Linux/2014-01/95512.htm 。可是这些博客都是针对老版本的Docker,安装方法是在升级操做系统内核版本的基础上完成。问题是,咱们不能够随意升级生产环境的操做系统内核版本,并且Docker0.7的主旨就是:Docker使用者能够在不升级内核的前提下,在RedHat环境这使用Docker。所以,这里撰写一篇博客,介绍如何在RedHat/CentOS环境下,安装新版本的Docker。api

1、禁用selinux
因为Selinux和LXC有冲突,因此须要禁用selinux。编辑/etc/selinux/config,设置两个关键变量。    
SELINUX=disabled 
SELINUXTYPE=targeted服务器

2、配置Fedora EPEL源
1 sudo yum install http://ftp.riken.jp/Linux/fedora/epel/6/x86_64/epel-release-6-8.noarch.rpmcors

3、添加hop5.repo源socket

cd /etc/yum.repos.d 
sudo wget http://www.hop5.in/yum/el6/hop5.repotcp

4、安装Docker
sudo yum install docker-ioide

图1是yum安装过程当中的截图,能够发现安装的软件只有docker和lxc相关包,没有内核包,例如kernel-ml-aufs。ui

在RedHat/CentOS下安装Docker(不升级内核)

图1 yum install docker-io输出截图this


5、初步验证docker
  输入docker -h,若是有以下输出,就证实docker在形式上已经安装成功。

# docker -h 
Usage of docker: 
  -D=false: Enable debug mode 
  -H=[]: Multiple tcp://host:port or unix://path/to/socket to bind in daemon mode, single connection otherwise 
  -api-enable-cors=false: Enable CORS headers in the remote API 
  -b="": Attach containers to a pre-existing network bridge; use 'none' to disable container networking 
  -bip="": Use this CIDR notation address for the network bridge's IP, not compatible with -b 
  -d=false: Enable daemon mode 
  -dns=[]: Force docker to use specific DNS servers 
  -g="/var/lib/docker": Path to use as the root of the docker runtime 
  -icc=true: Enable inter-container communication 
  -ip="0.0.0.0": Default IP address to use when binding container ports 
  -iptables=true: Disable docker's addition of iptables rules 
  -p="/var/run/docker.pid": Path to use for daemon PID file
  -r=true: Restart previously running containers 
  -s="": Force the docker runtime to use a specific storage driver 
  -v=false: Print version information and quit

Docker 的详细介绍请点这里
Docker 的下载地址请点这里

开源项目Docker,Red Hat新的虚拟化选择 http://www.linuxidc.com/Linux/2013-10/91051.htm

dockerlite: 轻量级 Linux 虚拟化 http://www.linuxidc.com/Linux/2013-07/87093.htm

Docker的搭建Gitlab CI 全过程详解 http://www.linuxidc.com/Linux/2013-12/93537.htm

Docker 和一个正常的虚拟机有何区别? http://www.linuxidc.com/Linux/2013-12/93740.htm

Docker 将改变全部事情 http://www.linuxidc.com/Linux/2013-12/93998.htm

转载于:http://www.linuxidc.com/Linux/2014-01/95513.htm

相关文章
相关标签/搜索