参考官方文档进行,地址如下:

https://docs.docker.com/engine/userguide/storagedriver/device-mapper-driver/#configure-docker-with-the-devicemapper-storage-driver

 

一、安装基础依赖

1、卸载老版本

2、设置REPOSITORY

yum install -y yum-utils device-mapper-persistent-data lvm2

3、启动extras额外的依赖库

yum-config-manager --enable extras

4、设置docker稳定的源

sudo yum-config-manager \
    --add-repo \
    https://download.docker.com/linux/centos/docker-ce.repo

5、启动docker.repo源

yum-config-manager --enable docker-ce-edge

 

二、安装docker

1、更新yum的安装索引

yum makecache fast

2、展示yum里能够提供的docker-ce的版本

yum list docker-ce.x86_64  --showduplicates |sort -r

3、安装docker版本

 

yum -y install docker-ce-17.03.1.ce

 

4、编辑/etc/docker/daemon.json,新建或者添加如下:

{
  
"storage-driver": "devicemapper"
}

5、官方推荐生产环节配置direct-lvm,配置步骤如下:

https://docs.docker.com/engine/userguide/storagedriver/device-mapper-driver/#configure-direct-lvm-mode-for-production

6、启动docker

systemctl start docker

7、启动一个容器测试

docker run hello-world

#出现如下及安装成功 

Hello from Docker!

This message shows that your installation appears to be working correctly.