Docker在centos上的安装
一、docker在CentOS 6上的安装
Docker仅支持64位系统,对于centos 6系统可以使用epel库安装docker,命令如下:
#yum -y install http://mirrors.yun-idc.com/epel/6/i386/epel-release-6-8.noarch.rpm
#yum -y install docker-io
例如:
# yum -y install http://mirrors.yun-idc.com/epel/6/i386/epel-release-6-8.noarch.rpmLoaded plugins: fastestmirrorDetermining fastest mirrors* base: mirror.bit.edu.cn* extras: mirrors.btte.net* updates: mirror.bit.edu.cnbase | 3.7 kB 00:00 extras | 3.4 kB 00:00 extras/primary_db | 29 kB 00:00 updates | 3.4 kB 00:00 updates/primary_db | 2.0 MB 00:00 Setting up Install Processepel-release-6-8.noarch.rpm | 14 kB 00:00 Examining /var/tmp/yum-root-Peszrf/epel-release-6-8.noarch.rpm: epel-release-6-8.noarchMarking /var/tmp/yum-root-Peszrf/epel-release-6-8.noarch.rpm to be installedResolving Dependencies–> Running transaction check—> Package epel-release.noarch 0:6-8 will be installed–> Finished Dependency ResolutionDependencies Resolved==========================================================================================================================================================================================================Package Arch Version Repository Size==========================================================================================================================================================================================================Installing:epel-release noarch 6-8 /epel-release-6-8.noarch 22 kTransaction Summary==========================================================================================================================================================================================================Install 1 Package(s)Total size: 22 kInstalled size: 22 kDownloading Packages:Running rpm_check_debugRunning Transaction TestTransaction Test SucceededRunning TransactionWarning: RPMDB altered outside of yum.** Found 12 pre-existing rpmdb problem(s), \’yum check\’ output follows:ant-1.7.1-13.el6.x86_64 has missing requires of java-devel >= (\’0\’, \’1.5.0\’, None)1:ecj-3.4.2-6.el6.x86_64 has missing requires of java-gcj-compat1:ecj-3.4.2-6.el6.x86_64 has missing requires of java-gcj-compatsinjdoc-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-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)xerces-j2-2.7.1-12.6.el6_0.x86_64 has missing requires of java-gcj >= (\’0\’, \’1.5.0\’, None)xerces-j2-2.7.1-12.6.el6_0.x86_64 has missing requires of java-gcj >= (\’0\’, \’1.5.0\’, None)xml-commons-apis-1.3.04-3.6.el6.x86_64 has missing requires of java-gcj-compatxml-commons-apis-1.3.04-3.6.el6.x86_64 has missing requires of java-gcj-compatxml-commons-resolver-1.1-4.18.el6.x86_64 has missing requires of java-gcj-compatxml-commons-resolver-1.1-4.18.el6.x86_64 has missing requires of java-gcj-compat Installing : epel-release-6-8.noarch 1/1 Verifying : epel-release-6-8.noarch 1/1Installed: epel-release.noarch 0:6-8 Complete! |
# yum -y install docker-ioLoaded plugins: fastestmirrorLoading mirror speeds from cached hostfileepel/metalink | 6.6 kB 00:00 * base: mirror.bit.edu.cn* epel: mirrors.tuna.tsinghua.edu.cn* extras: mirrors.btte.net* updates: mirror.bit.edu.cnbase | 3.7 kB 00:00 epel/primary_db | 5.9 MB 00:01 extras | 3.4 kB 00:00 updates | 3.4 kB 00:00 Setting up Install ProcessResolving 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–> Processing Dependency: libdevmapper.so.1.02(Base)(64bit) for package: docker-io-1.7.1-2.el6.x86_64–> Processing Dependency: libcgroup for package: docker-io-1.7.1-2.el6.x86_64–> Processing Dependency: device-mapper-libs for package: docker-io-1.7.1-2.el6.x86_64–> Processing Dependency: bridge-utils for package: docker-io-1.7.1-2.el6.x86_64–> Processing Dependency: libdevmapper.so.1.02()(64bit) for package: docker-io-1.7.1-2.el6.x86_64–> Running transaction check—> Package bridge-utils.x86_64 0:1.2-10.el6 will be installed—> Package device-mapper-libs.x86_64 0:1.02.117-12.el6 will be installed–> Processing Dependency: device-mapper = 1.02.117-12.el6 for package: device-mapper-libs-1.02.117-12.el6.x86_64–> Processing Dependency: libudev.so.0()(64bit) for package: device-mapper-libs-1.02.117-12.el6.x86_64—> Package libcgroup.x86_64 0:0.40.rc1-23.el6 will be installed—> Package lxc.x86_64 0:1.0.9-1.el6 will be installed–> Processing Dependency: lua-lxc(x86-64) = 1.0.9-1.el6 for package: lxc-1.0.9-1.el6.x86_64–> Processing Dependency: lua-alt-getopt for package: lxc-1.0.9-1.el6.x86_64–> Processing Dependency: liblxc.so.1()(64bit) for package: lxc-1.0.9-1.el6.x86_64–> Running transaction check—> Package device-mapper.x86_64 0:1.02.117-12.el6 will be installed—> Package libudev.x86_64 0:147-2.73.el6_8.2 will be installed—> Package lua-alt-getopt.noarch 0:0.7.0-1.el6 will be installed—> Package lua-lxc.x86_64 0:1.0.9-1.el6 will be installed–> Processing Dependency: lua-filesystem for package: lua-lxc-1.0.9-1.el6.x86_64—> Package lxc-libs.x86_64 0:1.0.9-1.el6 will be installed–> Running transaction check—> Package lua-filesystem.x86_64 0:1.4.2-1.el6 will be installed–> Finished Dependency ResolutionDependencies Resolved==========================================================================================================================================================================================================Package Arch Version Repository Size==========================================================================================================================================================================================================Installing:docker-io x86_64 1.7.1-2.el6 epel 4.6 MInstalling for dependencies:bridge-utils x86_64 1.2-10.el6 base 30 kdevice-mapper x86_64 1.02.117-12.el6 base 218 kdevice-mapper-libs x86_64 1.02.117-12.el6 base 257 klibcgroup x86_64 0.40.rc1-23.el6 base 131 klibudev x86_64 147-2.73.el6_8.2 base 78 klua-alt-getopt noarch 0.7.0-1.el6 epel 6.9 klua-filesystem x86_64 1.4.2-1.el6 epel 24 klua-lxc x86_64 1.0.9-1.el6 epel 16 klxc x86_64 1.0.9-1.el6 epel 122 klxc-libs x86_64 1.0.9-1.el6 epel 257 kTransaction Summary==========================================================================================================================================================================================================Install 11 Package(s)Total download size: 5.7 MInstalled size: 21 MDownloading Packages:(1/11): bridge-utils-1.2-10.el6.x86_64.rpm | 30 kB 00:00 (2/11): device-mapper-1.02.117-12.el6.x86_64.rpm | 218 kB 00:00 (3/11): device-mapper-libs-1.02.117-12.el6.x86_64.rpm | 257 kB 00:00 (4/11): docker-io-1.7.1-2.el6.x86_64.rpm | 4.6 MB 00:02 (5/11): libcgroup-0.40.rc1-23.el6.x86_64.rpm | 131 kB 00:00 (6/11): libudev-147-2.73.el6_8.2.x86_64.rpm | 78 kB 00:00 (7/11): lua-alt-getopt-0.7.0-1.el6.noarch.rpm | 6.9 kB 00:00 (8/11): lua-filesystem-1.4.2-1.el6.x86_64.rpm | 24 kB 00:00 (9/11): lua-lxc-1.0.9-1.el6.x86_64.rpm | 16 kB 00:00 (10/11): lxc-1.0.9-1.el6.x86_64.rpm | 122 kB 00:00 (11/11): lxc-libs-1.0.9-1.el6.x86_64.rpm | 257 kB 00:00 ———————————————————————————————————————————————————————————————————-Total 2.0 MB/s | 5.7 MB 00:02 warning: rpmts_HdrFromFdno: Header V3 RSA/SHA256 Signature, key ID 0608b895: NOKEYRetrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6Importing GPG key 0x0608B895:Userid : EPEL (6) <epel@fedoraproject.org>Package: epel-release-6-8.noarch (@/epel-release-6-8.noarch)From : /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6Running rpm_check_debugRunning Transaction TestTransaction Test SucceededRunning Transaction Installing : lxc-libs-1.0.9-1.el6.x86_64 1/11 Installing : libudev-147-2.73.el6_8.2.x86_64 2/11 Installing : device-mapper-1.02.117-12.el6.x86_64 3/11 Installing : device-mapper-libs-1.02.117-12.el6.x86_64 4/11 Installing : lua-filesystem-1.4.2-1.el6.x86_64 5/11 Installing : lua-lxc-1.0.9-1.el6.x86_64 6/11 Installing : libcgroup-0.40.rc1-23.el6.x86_64 7/11 Installing : lua-alt-getopt-0.7.0-1.el6.noarch 8/11 Installing : lxc-1.0.9-1.el6.x86_64 9/11 Installing : bridge-utils-1.2-10.el6.x86_64 10/11 Installing : docker-io-1.7.1-2.el6.x86_64 11/11 Verifying : device-mapper-libs-1.02.117-12.el6.x86_64 1/11 Verifying : libudev-147-2.73.el6_8.2.x86_64 2/11 Verifying : lua-lxc-1.0.9-1.el6.x86_64 3/11 Verifying : lxc-libs-1.0.9-1.el6.x86_64 4/11 Verifying : bridge-utils-1.2-10.el6.x86_64 5/11 Verifying : device-mapper-1.02.117-12.el6.x86_64 6/11 Verifying : lxc-1.0.9-1.el6.x86_64 7/11 Verifying : docker-io-1.7.1-2.el6.x86_64 8/11 Verifying : lua-alt-getopt-0.7.0-1.el6.noarch 9/11 Verifying : libcgroup-0.40.rc1-23.el6.x86_64 10/11 Verifying : lua-filesystem-1.4.2-1.el6.x86_64 11/11Installed: docker-io.x86_64 0:1.7.1-2.el6 Dependency Installed: bridge-utils.x86_64 0:1.2-10.el6 device-mapper.x86_64 0:1.02.117-12.el6 device-mapper-libs.x86_64 0:1.02.117-12.el6 libcgroup.x86_64 0:0.40.rc1-23.el6 libudev.x86_64 0:147-2.73.el6_8.2 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.9-1.el6 lxc.x86_64 0:1.0.9-1.el6 lxc-libs.x86_64 0:1.0.9-1.el6 Complete! |
检查并启动docker:# rpm -qa|grep epelepel-release-6-8.noarch# rpm -qa|grep dockerdocker-io-1.7.1-2.el6.x86_64# service docker statusdocker is stopped# service docker startStarting cgconfig service: [ OK ]Starting docker: [ OK ] |
二、Docker在centos 7上的安装
对于centos 7系统,由于centos-extras源中已内置docker,可以直接使用yum进行安装:
#yum -y install docker