docker安装

1、安装 Fedora EPEL

yum -y install

http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm


2、安装docker

yum -y install docker-io

[root@localhost ~]# yum -y install docker-io
Loaded plugins: fastestmirror, refresh-packagekit, security
Setting up Install Process
Loading mirror speeds from cached hostfile
epel/metalink                                                                  
 * base: mirrors.163.com
 * epel: mirrors.tongji.edu.cn
 * extras: mirrors.cn99.com
 * updates: mirrors.cn99.com
epel                                                                           
epel/primary_db                                                                
Resolving Dependencies
--> Running transaction check
---> Package docker-io.x86_64 0:1.7.1-2.el6 will be installed
--> Processing Dependency: libcgroup for package: docker-io-1.7.1-2.el6.x86_64
--> Processing Dependency: lxc for package: docker-io-1.7.1-2.el6.x86_64
--> Running transaction check
---> Package libcgroup.x86_64 0:0.40.rc1-24.el6_9 will be installed
---> Package lxc.x86_64 0:1.0.11-1.el6 will be installed
--> Processing Dependency: lua-lxc(x86-64) = 1.0.11-1.el6 for package: lxc-1.0.
--> Processing Dependency: lua-alt-getopt for package: lxc-1.0.11-1.el6.x86_64
--> Processing Dependency: liblxc.so.1()(64bit) for package: lxc-1.0.11-1.el6.x
--> Running transaction check
---> Package lua-alt-getopt.noarch 0:0.7.0-1.el6 will be installed
---> Package lua-lxc.x86_64 0:1.0.11-1.el6 will be installed
--> Processing Dependency: lua-filesystem for package: lua-lxc-1.0.11-1.el6.x86
---> Package lxc-libs.x86_64 0:1.0.11-1.el6 will be installed
--> Running transaction check
---> Package lua-filesystem.x86_64 0:1.4.2-1.el6 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

===============================================================================
 Package                     Arch                Version                       
===============================================================================
Installing:
 docker-io                   x86_64              1.7.1-2.el6                   
Installing for dependencies:
 libcgroup                   x86_64              0.40.rc1-24.el6_9             
 lua-alt-getopt              noarch              0.7.0-1.el6                   
 lua-filesystem              x86_64              1.4.2-1.el6                   
 lua-lxc                     x86_64              1.0.11-1.el6                  
 lxc                         x86_64              1.0.11-1.el6                  
 lxc-libs                    x86_64              1.0.11-1.el6                  

Transaction Summary
===============================================================================
Install       7 Package(s)

Total download size: 5.1 M
Installed size: 20 M
Downloading Packages:
(1/7): docker-io-1.7.1-2.el6.x86_64.rpm                                        
(2/7): libcgroup-0.40.rc1-24.el6_9.x86_64.rpm                                  
(3/7): lua-alt-getopt-0.7.0-1.el6.noarch.rpm                                   
(4/7): lua-filesystem-1.4.2-1.el6.x86_64.rpm                                   
(5/7): lua-lxc-1.0.11-1.el6.x86_64.rpm                                         
(6/7): lxc-1.0.11-1.el6.x86_64.rpm                                             
(7/7): lxc-libs-1.0.11-1.el6.x86_64.rpm                                        
-------------------------------------------------------------------------------
Total                                                                       2.3
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Warning: RPMDB altered outside of yum.
** Found 3 pre-existing rpmdb problem(s), 'yum check' output follows:
2:postfix-2.6.6-2.2.el6_1.x86_64 has missing requires of libmysqlclient.so.16()
2:postfix-2.6.6-2.2.el6_1.x86_64 has missing requires of libmysqlclient.so.16(l
2:postfix-2.6.6-2.2.el6_1.x86_64 has missing requires of mysql-libs
  Installing : lxc-libs-1.0.11-1.el6.x86_64                                    
  Installing : lua-filesystem-1.4.2-1.el6.x86_64                               
  Installing : lua-lxc-1.0.11-1.el6.x86_64                                     
  Installing : lua-alt-getopt-0.7.0-1.el6.noarch                               
  Installing : lxc-1.0.11-1.el6.x86_64                                         
  Installing : libcgroup-0.40.rc1-24.el6_9.x86_64                              
  Installing : docker-io-1.7.1-2.el6.x86_64                                    
  Verifying  : lxc-1.0.11-1.el6.x86_64                                         
  Verifying  : lua-lxc-1.0.11-1.el6.x86_64                                     
  Verifying  : lxc-libs-1.0.11-1.el6.x86_64                                    
  Verifying  : libcgroup-0.40.rc1-24.el6_9.x86_64                              
  Verifying  : docker-io-1.7.1-2.el6.x86_64                                    
  Verifying  : lua-alt-getopt-0.7.0-1.el6.noarch                               
  Verifying  : lua-filesystem-1.4.2-1.el6.x86_64                               

Installed:
  docker-io.x86_64 0:1.7.1-2.el6                                               

Dependency Installed:
  libcgroup.x86_64 0:0.40.rc1-24.el6_9                  lua-alt-getopt.noarch 0
  lua-filesystem.x86_64 0:1.4.2-1.el6                   lua-lxc.x86_64 0:1.0.11
  lxc.x86_64 0:1.0.11-1.el6                             lxc-libs.x86_64 0:1.0.1

Complete!

3、启动docker

docker -d

这个时候会报错, 说内核需要升级到3.10.0
后面又提示libdevmapper.so的错误,
需要升级device-mapper-libs

WARN[0000] You are running linux kernel version 2.6.32-431.el6.x86_64, which might be unstable running docker. Please upgrade your kernel to 3.10.0. 
INFO[0000] Listening for HTTP on unix (/var/run/docker.sock) 
docker: relocation error: docker: symbol dm_task_get_info_with_deferred_remove, version Base not defined in file libdevmapper.so.1.02 with link time reference

4、解决libdevmapper.so的错误

yum upgrade device-mapper-libs -y

这个时候,会提示:

Loaded plugins: fastestmirror, refresh-packagekit, security
Setting up Upgrade Process
Loading mirror speeds from cached hostfile
 * base: mirrors.163.com
 * epel: mirror01.idc.hinet.net
 * extras: mirrors.cn99.com
 * updates: mirrors.cn99.com
Resolving Dependencies
--> Running transaction check
---> Package device-mapper-libs.x86_64 0:1.02.79-8.el6 will be updated
--> Processing Dependency: device-mapper-libs = 1.02.79-8.el6 for package: device-mapper-1.02.79-8.el6.x86_64
---> Package device-mapper-libs.x86_64 0:1.02.117-12.el6_9.1 will be an update
--> Running transaction check
---> Package device-mapper.x86_64 0:1.02.79-8.el6 will be updated
--> Processing Dependency: device-mapper = 1.02.79-8.el6 for package: device-mapper-event-1.02.79-8.el6.x86_64
---> Package device-mapper.x86_64 0:1.02.117-12.el6_9.1 will be an update
--> Running transaction check
---> Package device-mapper-event.x86_64 0:1.02.79-8.el6 will be updated
---> Package device-mapper-event.x86_64 0:1.02.117-12.el6_9.1 will be an update
--> Processing Dependency: device-mapper-event-libs = 1.02.117-12.el6_9.1 for package: device-mapper-event-1.02.117-12.el6_9.1.x86_64
--> Running transaction check
---> Package device-mapper-event-libs.x86_64 0:1.02.79-8.el6 will be updated
---> Package device-mapper-event-libs.x86_64 0:1.02.117-12.el6_9.1 will be an update
--> Processing Conflict: device-mapper-event-1.02.117-12.el6_9.1.x86_64 conflicts lvm2-libs < 2.02.111
--> Restarting Dependency Resolution with new changes.
--> Running transaction check
---> Package lvm2-libs.x86_64 0:2.02.100-8.el6 will be updated
--> Processing Dependency: lvm2-libs = 2.02.100-8.el6 for package: lvm2-2.02.100-8.el6.x86_64
---> Package lvm2-libs.x86_64 0:2.02.143-12.el6_9.1 will be an update
--> Running transaction check
---> Package lvm2.x86_64 0:2.02.100-8.el6 will be updated
---> Package lvm2.x86_64 0:2.02.143-12.el6_9.1 will be an update
--> Processing Dependency: device-mapper-persistent-data >= 0.6.2 for package: lvm2-2.02.143-12.el6_9.1.x86_64
--> Running transaction check
---> Package device-mapper-persistent-data.x86_64 0:0.2.8-2.el6 will be updated
---> Package device-mapper-persistent-data.x86_64 0:0.6.2-0.1.rc7.el6 will be an update
--> Finished Dependency Resolution

Dependencies Resolved

===============================================================================
 Package                        Arch    Version                 Repository
                                                                          Size
===============================================================================
Updating:
 device-mapper-libs             x86_64  1.02.117-12.el6_9.1     updates  257 k
 lvm2-libs                      x86_64  2.02.143-12.el6_9.1     updates  1.0 M
Updating for dependencies:
 device-mapper                  x86_64  1.02.117-12.el6_9.1     updates  218 k
 device-mapper-event            x86_64  1.02.117-12.el6_9.1     updates  134 k
 device-mapper-event-libs       x86_64  1.02.117-12.el6_9.1     updates  126 k
 device-mapper-persistent-data  x86_64  0.6.2-0.1.rc7.el6       base     463 k
 lvm2                           x86_64  2.02.143-12.el6_9.1     updates  941 k

Transaction Summary
===============================================================================
Upgrade       7 Package(s)

Total download size: 3.1 M
Downloading Packages:
(1/7): device-mapper-1.02.117-12.el6_9.1.x86_64.rpm     | 218 kB     00:00     
(2/7): device-mapper-event-1.02.117-12.el6_9.1.x86_64.r | 134 kB     00:00     
(3/7): device-mapper-event-libs-1.02.117-12.el6_9.1.x86 | 126 kB     00:00     
(4/7): device-mapper-libs-1.02.117-12.el6_9.1.x86_64.rp | 257 kB     00:00     
(5/7): device-mapper-persistent-data-0.6.2-0.1.rc7.el6. | 463 kB     00:00     
(6/7): lvm2-2.02.143-12.el6_9.1.x86_64.rpm              | 941 kB     00:00     
(7/7): lvm2-libs-2.02.143-12.el6_9.1.x86_64.rpm         | 1.0 MB     00:00     
-------------------------------------------------------------------------------
Total                                          2.3 MB/s | 3.1 MB     00:01     
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Updating   : device-mapper-1.02.117-12.el6_9.1.x86_64                   1/14 
  Updating   : device-mapper-libs-1.02.117-12.el6_9.1.x86_64              2/14 
  Updating   : device-mapper-event-libs-1.02.117-12.el6_9.1.x86_64        3/14 
  Updating   : device-mapper-event-1.02.117-12.el6_9.1.x86_64             4/14 
  Updating   : lvm2-libs-2.02.143-12.el6_9.1.x86_64                       5/14 
  Updating   : device-mapper-persistent-data-0.6.2-0.1.rc7.el6.x86_64     6/14 
  Updating   : lvm2-2.02.143-12.el6_9.1.x86_64                            7/14 
  Cleanup    : lvm2-2.02.100-8.el6.x86_64                                 8/14 
  Cleanup    : lvm2-libs-2.02.100-8.el6.x86_64                            9/14 
  Cleanup    : device-mapper-event-1.02.79-8.el6.x86_64                  10/14 
  Cleanup    : device-mapper-event-libs-1.02.79-8.el6.x86_64             11/14 
  Cleanup    : device-mapper-1.02.79-8.el6.x86_64                        12/14 
  Cleanup    : device-mapper-libs-1.02.79-8.el6.x86_64                   13/14 
  Cleanup    : device-mapper-persistent-data-0.2.8-2.el6.x86_64          14/14 
  Verifying  : lvm2-libs-2.02.143-12.el6_9.1.x86_64                       1/14 
  Verifying  : lvm2-2.02.143-12.el6_9.1.x86_64                            2/14 
  Verifying  : device-mapper-libs-1.02.117-12.el6_9.1.x86_64              3/14 
  Verifying  : device-mapper-event-1.02.117-12.el6_9.1.x86_64             4/14 
  Verifying  : device-mapper-persistent-data-0.6.2-0.1.rc7.el6.x86_64     5/14 
  Verifying  : device-mapper-event-libs-1.02.117-12.el6_9.1.x86_64        6/14 
  Verifying  : device-mapper-1.02.117-12.el6_9.1.x86_64                   7/14 
  Verifying  : device-mapper-1.02.79-8.el6.x86_64                         8/14 
  Verifying  : device-mapper-event-libs-1.02.79-8.el6.x86_64              9/14 
  Verifying  : device-mapper-persistent-data-0.2.8-2.el6.x86_64          10/14 
  Verifying  : device-mapper-event-1.02.79-8.el6.x86_64                  11/14 
  Verifying  : lvm2-libs-2.02.100-8.el6.x86_64                           12/14 
  Verifying  : device-mapper-libs-1.02.79-8.el6.x86_64                   13/14 
  Verifying  : lvm2-2.02.100-8.el6.x86_64                                14/14 

Updated:
  device-mapper-libs.x86_64 0:1.02.117-12.el6_9.1                              
  lvm2-libs.x86_64 0:2.02.143-12.el6_9.1                                       

Dependency Updated:
  device-mapper.x86_64 0:1.02.117-12.el6_9.1                                   
  device-mapper-event.x86_64 0:1.02.117-12.el6_9.1                             
  device-mapper-event-libs.x86_64 0:1.02.117-12.el6_9.1                        
  device-mapper-persistent-data.x86_64 0:0.6.2-0.1.rc7.el6                     
  lvm2.x86_64 0:2.02.143-12.el6_9.1                                            

Complete!

5、重新启动docker
service docker restart

自己还reboot重启了服务器


6、查看docker info
docker info

Containers: 0
Images: 9
Storage Driver: devicemapper
 Pool Name: docker-8:2-409573-pool
 Pool Blocksize: 65.54 kB
 Backing Filesystem: extfs
 Data file: /dev/loop0
 Metadata file: /dev/loop1
 Data Space Used: 684.1 MB
 Data Space Total: 107.4 GB
 Data Space Available: 11.14 GB
 Metadata Space Used: 1.135 MB
 Metadata Space Total: 2.147 GB
 Metadata Space Available: 2.146 GB
 Udev Sync Supported: true
 Deferred Removal Enabled: false
 Data loop file: /var/lib/docker/devicemapper/devicemapper/data
 Metadata loop file: /var/lib/docker/devicemapper/devicemapper/metadata
 Library Version: 1.02.117-RHEL6 (2016-12-13)
Execution Driver: native-0.2
Logging Driver: json-file
Kernel Version: 2.6.32-431.el6.x86_64
Operating System: <unknown>
CPUs: 2
Total Memory: 980.9 MiB
Name: localhost.localdomain

7、 安装测试
这个时候,我们安装一个centos试试

docker pull centos

或者, 安装一个ubuntu
docker pull ubuntu

latest: Pulling from centos
6c5159923047: Pull complete 
acec82331181: Pull complete 
e74c56fbba84: Pull complete 
Digest: sha256:c7330fca6b18219311be4bac27535b5d8e6fa9b77c43605bdfd9e177c291be57
Status: Downloaded newer image for centos:latest
[root@localhost ~]# docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             VIRTUAL SIZE
centos              latest              e74c56fbba84        2 weeks ago         196.6 MB

: )

©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 204,793评论 6 478
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 87,567评论 2 381
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 151,342评论 0 338
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 54,825评论 1 277
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 63,814评论 5 368
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 48,680评论 1 281
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 38,033评论 3 399
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 36,687评论 0 258
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 42,175评论 1 300
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 35,668评论 2 321
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 37,775评论 1 332
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 33,419评论 4 321
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 39,020评论 3 307
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 29,978评论 0 19
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 31,206评论 1 260
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 45,092评论 2 351
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 42,510评论 2 343

推荐阅读更多精彩内容

  • 由于个人喜好,用到了docker 应用容器引擎,具体关于docker的介绍啥的这里就不说了,本文主要讲讲 cent...
    逐暗者阅读 390评论 0 4
  • Docker 是一个开源的应用容器引擎,让开发者可以打包他们的应用以及依赖包到一个可移植的容器中,然后发布到任何流...
    ProteanBear阅读 1,360评论 0 3
  • 简单来说下: Docker目标是实现轻量级的操作系统虚拟化解决方案。Docker 的基础是Linux容器(LX...
    Dy_Superman阅读 267评论 0 0
  • 注:原文地址:http://severalnines.com/blog/mysql-docker-containe...
    空乱木阅读 5,957评论 0 7
  • 人为什么会得癌症? 化疗、靶向治疗和免疫治疗分别是什么? 癌症留言哪些靠谱,哪些不靠谱? 看看封面上简单的几个问题...
    王三藏阅读 400评论 2 0