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

: )

本文参与腾讯云自媒体分享计划,欢迎正在阅读的你也加入,一起分享。

我来说两句

0 条评论
登录 后参与评论

相关文章

  • 新idea问题汇总

    一些原因,自己又重装了idea 打开后,配置界面变化很多 下面是出现的问题,不定时归纳一下:

    dodo_lihao
  • 鸿洋AutoLayout代码分析(二):获取Manifest中的值

    从AndroidManifest.xml中去取值,自己觉得应该和 PackageManager 或 Manifest 有关 (Manifest 简单是一个容器...

    dodo_lihao
  • Centos上phpstudy搭建

    自己最近也没有怎么弄过linux了 一些原因,自己买了一个Centos的腾讯云服务器 既然买了玩玩,就不要放着了 自己搭建一个php的集成环境 向所有认...

    dodo_lihao
  • cronie所依赖的包

    CentOS6.3 x86_64 最小化安装版安装cronie yum -y install cronie 通过这个命令可得出安装cronie所得依赖包如下

    三杯水Plus
  • CentOS6.3 x86_64位安装xfce4桌面vncserver服务

    CentOS6.3 x86_64位安装xfce4桌面vncserver服务 注意这里用的是最小化安装纯净系统212个包CentOS-6.3-x86_64-...

    三杯水Plus
  • 使用yum快速部署Oracle安装环境(11g)

        基于Linux安装过Oracle的童鞋们都应该清楚,安装Oracle的确是一件比较费时费力的差事,因为仅仅是前期的rpm包,内核参数,创建用户等等这些个...

    Leshami
  • CentOS6.9下制作一键安装的ISO系统镜像

    rootpw --iscrypted $1$ymZM2uhc$2W.ZFogcbMq3qz5C7.Azd.

    yuanfan2012
  • zabbix-server端与zabbix-agent端部署与监控

    环境: [root@redis ~]# uname -a Linux redis 2.6.32-696.el6.x86_64 #1 SMP Tue Mar 21...

    863987322
  • 3分钟,YUM升级MYSQL,5.1到5

    本文介绍如何通过YUM升级Mysql的版本(默认用YUM安装的MySQL都是5.1的版本)

    py3study
  • Centos中yum方式安装java

    查看CentOS自带JDK是否已安装。 ◆输入:yum list installed |grep java。 若有自带安装的JDK,如何卸载CentOS系统自带...

    洗尽了浮华

扫码关注云+社区

领取腾讯云代金券