centos6.5 下装docker

2016-10-10 09:02:56

   1、首先关闭selinux:

setenforce 0 

sed -i '/^SELINUX=/c\SELINUX=disabled' /etc/selinux/config


    2、在Fedora EPEL源中已经提供了docker-io包,下载安装epel:

rpm -ivh http://mirrors.sohu.com/fedora-epel/6/x86_64/epel-release-6-8.noarch.rpm
sed -i 's/^mirrorlist=https/mirrorlist=http/' /etc/yum.repos.d/epel.repo

    3、yum安装docker-io:

yum -y install docker-io
Loaded plugins: fastestmirror, security
Setting up Install Process
Loading mirror speeds from cached hostfile
epel/metalink                                            | 5.8 kB     00:00     
 * epel: mirror.pregi.net
epel                                                     | 4.3 kB     00:00     
http://mirror.pregi.net/epel/6/x86_64/repodata/repomd.xml: [Errno -1] repomd.xml 
does not match metalink for epel
Trying other mirror.
epel                                                     | 4.3 kB     00:00     
epel/primary_db                                          | 5.9 MB     01:04     
Resolving Dependencies
--> Running transaction check
---> Package docker-io.x86_64 0:1.7.1-2.el6 will be installed
--> Processing Dependency: lxc for package: docker-io-1.7.1-2.el6.x86_64
--> Running transaction check
---> Package lxc.x86_64 0:1.0.8-1.el6 will be installed
--> Processing Dependency: lua-lxc(x86-64) = 1.0.8-1.el6 for package: lxc-1.0.8-1.el6.x86_64
--> Processing Dependency: lua-alt-getopt for package: lxc-1.0.8-1.el6.x86_64
--> Processing Dependency: liblxc.so.1()(64bit) for package: lxc-1.0.8-1.el6.x86_64
--> 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.8-1.el6 will be installed
--> Processing Dependency: lua-filesystem for package: lua-lxc-1.0.8-1.el6.x86_64
---> Package lxc-libs.x86_64 0:1.0.8-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               Repository    Size
================================================================================
Installing:
 docker-io              x86_64         1.7.1-2.el6           epel         4.6 M
Installing for dependencies:
 lua-alt-getopt         noarch         0.7.0-1.el6           epel         6.9 k
 lua-filesystem         x86_64         1.4.2-1.el6           epel          24 k
 lua-lxc                x86_64         1.0.8-1.el6           epel          16 k
 lxc                    x86_64         1.0.8-1.el6           epel         122 k
 lxc-libs               x86_64         1.0.8-1.el6           epel         255 k

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

Total download size: 5.0 M
Installed size: 20 M
Downloading Packages:
(1/6): docker-io-1.7.1-2.el6.x86_64.rpm                  | 4.6 MB     01:11     
(2/6): lua-alt-getopt-0.7.0-1.el6.noarch.rpm             | 6.9 kB     00:00     
(3/6): lua-filesystem-1.4.2-1.el6.x86_64.rpm             |  24 kB     00:00     
(4/6): lua-lxc-1.0.8-1.el6.x86_64.rpm                    |  16 kB     00:00     
(5/6): lxc-1.0.8-1.el6.x86_64.rpm                        | 122 kB     00:01     
(6/6): lxc-libs-1.0.8-1.el6.x86_64.rpm                   | 255 kB     00:02     
--------------------------------------------------------------------------------
Total                                            65 kB/s | 5.0 MB     01:19     
warning: rpmts_HdrFromFdno: Header V3 RSA/SHA256 Signature, key ID 0608b895: NOKEY
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
Importing GPG key 0x0608B895:
 Userid : EPEL (6) <epel@fedoraproject.org>
 Package: epel-release-6-8.noarch (installed)
 From   : /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
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:
1:ecj-3.4.2-6.el6.x86_64 has missing requires of java-gcj-compat
sinjdoc-0.5-9.1.el6.x86_64 has missing requires of java-gcj-compat >= ('0', '1.0.70', None)
sinjdoc-0.5-9.1.el6.x86_64 has missing requires of java_cup >= ('0', '0.10', None)
  Installing : lxc-libs-1.0.8-1.el6.x86_64                                  1/6 
  Installing : lua-filesystem-1.4.2-1.el6.x86_64                            2/6 
  Installing : lua-lxc-1.0.8-1.el6.x86_64                                   3/6 
  Installing : lua-alt-getopt-0.7.0-1.el6.noarch                            4/6 
  Installing : lxc-1.0.8-1.el6.x86_64                                       5/6 
  Installing : docker-io-1.7.1-2.el6.x86_64                                 6/6 
  Verifying  : lxc-libs-1.0.8-1.el6.x86_64                                  1/6 
  Verifying  : lua-lxc-1.0.8-1.el6.x86_64                                   2/6 
  Verifying  : lxc-1.0.8-1.el6.x86_64                                       3/6 
  Verifying  : docker-io-1.7.1-2.el6.x86_64                                 4/6 
  Verifying  : lua-alt-getopt-0.7.0-1.el6.noarch                            5/6 
  Verifying  : lua-filesystem-1.4.2-1.el6.x86_64                            6/6 

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

Dependency Installed:
  lua-alt-getopt.noarch 0:0.7.0-1.el6    lua-filesystem.x86_64 0:1.4.2-1.el6   
  lua-lxc.x86_64 0:1.0.8-1.el6           lxc.x86_64 0:1.0.8-1.el6              
  lxc-libs.x86_64 0:1.0.8-1.el6         

Complete!

启动docker

service docker start
[root@test-node ~]# service docker start
Starting cgconfig service:                                 [  OK  ]
Starting docker:                                           [  OK  ]

确定docker 版本

[root@test-node ~]# docker version
Client version: 1.7.1
Client API version: 1.19
Go version (client): go1.4.2
Git commit (client): 786b29d/1.7.1
OS/Arch (client): linux/amd64
Server version: 1.7.1
Server API version: 1.19
Go version (server): go1.4.2
Git commit (server): 786b29d/1.7.1
OS/Arch (server): linux/amd64


你打算打赏多少钱呢?

打赏
(微信扫一扫)