首页 > 代码库 > Docker在Centos7下的安装

Docker在Centos7下的安装

一、检查前提条件

  1. 内核

   检查内核的版本是否安装了3.8或更高的版本

[root@localhost ~]# uname -a
Linux localhost.localdomain 3.10.0-123.13.2.el7.x86_64 #1 SMP Thu Dec 18 14:09:13 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux

 2.检查Device Mapper

[root@localhost ~]# ls -l /sys/class/misc/device-mapper/
总用量 0
-r--r--r--. 1 root root 4096 12月 28 17:18 dev
drwxr-xr-x. 2 root root    0 12月 28 17:14 power
lrwxrwxrwx. 1 root root    0 12月 28 17:18 subsystem -> ../../../../class/misc
-rw-r--r--. 1 root root 4096 12月 28 17:13 uevent

或者在/proc/device文件中检查是否有device-mapper条目

[root@localhost ~]# grep device-mapper /proc/devices
253 device-mapper

二、安装Docker

[root@localhost ~]# yum -y install docker

已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.btte.net
 * epel: ftp.sjtu.edu.cn
 * extras: mirrors.btte.net
 * updates: mirrors.neusoft.edu.cn
正在解决依赖关系
--> 正在检查事务
---> 软件包 docker.x86_64.0.1.3.2-4.el7.centos 将被 安装
--> 解决依赖关系完成

依赖关系解决

===========================================================================================
 Package     架构                       版本                       源                                          大小
===========================================================================================
正在安装:
 docker      x86_64              1.3.2-4.el7.centos       extras                                     5.6 M

事务概要
===========================================================================================
安装  1 软件包

总下载量:5.6 M
安装大小:24 M
Downloading packages:
docker-1.3.2-4.el7.centos.x86_64.rpm                                                                                                                                    | 5.6 MB  00:00:04    
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  正在安装    : docker-1.3.2-4.el7.centos.x86_64                                                                                                                                           1/1
  验证中      : docker-1.3.2-4.el7.centos.x86_64                                                                                                                                           1/1

已安装:
  docker.x86_64 0:1.3.2-4.el7.centos                                                                                                                                                          

完毕!

三、启动Docker进程

[root@localhost ~]# systemctl start docker

 

如果想在开机的时间自动启动Docker服务,执行如下命令

[root@localhost ~]# systemctl enable docker
ln -s ‘/usr/lib/systemd/system/docker.service‘ ‘/etc/systemd/system/multi-user.target.wants/docker.service‘

 

查看Docker是否运行

[root@localhost ~]# docker info
Containers: 0
Images: 0
Storage Driver: devicemapper
 Pool Name: docker-253:1-614613-pool
 Pool Blocksize: 65.54 kB
 Data file: /var/lib/docker/devicemapper/devicemapper/data
 Metadata file: /var/lib/docker/devicemapper/devicemapper/metadata
 Data Space Used: 307.2 MB
 Data Space Total: 107.4 GB
 Metadata Space Used: 725 kB
 Metadata Space Total: 2.147 GB
 Library Version: 1.02.84-RHEL7 (2014-03-26)
Execution Driver: native-0.2
Kernel Version: 3.10.0-123.13.2.el7.x86_64
Operating System: CentOS Linux 7 (Core)

本文出自 “云人生” 博客,请务必保留此出处http://ovcer.blog.51cto.com/1145188/1596786

Docker在Centos7下的安装