在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

相關文章
相關標籤/搜索