CentOS/Ubuntuのバージョンとインストール手順によるDockerバージョンとストレージドライバの差異

先日[DQNEOさん](http://qiita.com/DQNEO)が[Docker = AUFSという図式はもう忘れたほうがいいかもしれない、あるいはDockerとストレージドライバの話](http://qiita.com/DQNEO/items/ee0caf80b056487cb762)という記事を書かれていましたが、面白そうなのでSoftLayer上のHourly Virtual Server（Public node）で試してみました。

Dockerのインストール手順は、基本的にDocker公式のインストール手順（[https://docs.docker.com/installation/](https://docs.docker.com/installation/)）に従っています。

※各種バージョンなどは、2015/04/07時点のものです

## 結果

|OS|Docker install方法|Docker version|Storage Driver|
|:--|:--|:--|:--|
|CentOS7.1|yum|1.5.0-dev|devicemapper|
|CentOS7.1|最新binary|1.5.0|devicemapper|
|CentOS6.6|epel+yum|1.4.1|devicemapper|
|CentOS6.6|epel+最新binary|1.5.0|devicemapper|
|Ubuntu14.04|apt|1.0.1|devicemapper|
|Ubuntu14.04|install scriptをwget|1.5.0|aufs|
|Ubuntu12.04|install scriptをwget|1.5.0|aufs|
|Debian7.8|install scriptをwget|1.5.0|aufs|

CentOS7/6にDockerをインストールした場合、及びUbuntu14.04にaptでDockerをインストールした場合は、デフォルトのStorage Driverはdevicemapperになるようです。またデフォルト設定では、このdevicemapperはスパースファイルのループバックデバイスでThin Provisioningされています。

一方Ubuntuやdebianにinstall script（[コレ](https://get.docker.com/)）を用いてDockerをインストールした場合、デフォルトのStorage DriverはAUFSになるようです。スクリプトを見る限りDocker社はdevicemapperよりAUFSが好きらしく（ **"aufs is preferred over devicemapper"** とコメントされています）、AUFSがなければスクリプト内でインストールまでするようです。

## CentOS 7.1 - yum

```text:カーネルのバージョン
[root@centos7-yum ~]# yum update -y
[root@centos7-yum ~]# cat /etc/redhat-release 
CentOS Linux release 7.1.1503 (Core) 
[root@centos7-yum ~]# uname -r
3.10.0-123.20.1.el7.x86_64
```

```text:Dockerインストール
[root@centos7-yum ~]# yum install docker -y
[root@centos7-yum ~]# systemctl start docker
```

```text:Dockerの状態
[root@centos7-yum ~]# docker version
Client version: 1.5.0-dev
Client API version: 1.18
Go version (client): go1.3.3
Git commit (client): fc0329b/1.5.0
OS/Arch (client): linux/amd64
Server version: 1.5.0-dev
Server API version: 1.18
Go version (server): go1.3.3
Git commit (server): fc0329b/1.5.0
OS/Arch (server): linux/amd64

[root@centos7-yum ~]# docker info
Containers: 0
Images: 0
Storage Driver: devicemapper
 Pool Name: docker-202:2-336066-pool
 Pool Blocksize: 65.54 kB
 Backing Filesystem: extfs
 Data file: /dev/loop0
 Metadata file: /dev/loop1
 Data Space Used: 307.2 MB
 Data Space Total: 107.4 GB
 Data Space Available: 24.41 GB
 Metadata Space Used: 729.1 kB
 Metadata Space Total: 2.147 GB
 Metadata Space Available: 2.147 GB
 Udev Sync Supported: true
 Data loop file: /var/lib/docker/devicemapper/devicemapper/data
 Metadata loop file: /var/lib/docker/devicemapper/devicemapper/metadata
 Library Version: 1.02.93-RHEL7 (2015-01-28)
Execution Driver: native-0.2
Kernel Version: 3.10.0-123.20.1.el7.x86_64
Operating System: CentOS Linux 7 (Core)
CPUs: 1
Total Memory: 988.9 MiB
Name: centos7-yum
ID: AQTZ:WIIR:5T3F:SXUY:UHTP:KX23:BBRR:XSJN:KAHY:N7MJ:EUX4:GCHY

[root@centos7-yum ~]# lsblk
NAME                         MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
loop0                          7:0    0  100G  0 loop 
└─docker-202:2-336066-pool   253:0    0  100G  0 dm   
  └─docker-202:2-336066-base 253:1    0   10G  0 dm   
loop1                          7:1    0    2G  0 loop 
└─docker-202:2-336066-pool   253:0    0  100G  0 dm   
  └─docker-202:2-336066-base 253:1    0   10G  0 dm   


[root@centos7-yum ~]# ls -alhs /var/lib/docker/devicemapper/devicemapper/data 
293M -rw------- 1 root root 100G  4月  6 20:21 /var/lib/docker/devicemapper/devicemapper/data
```

## CentOS 7.1 - binary

```text:カーネルのバージョン
[root@centos7-bin ~]# yum update -y
[root@centos7-bin ~]# cat /etc/redhat-release 
CentOS Linux release 7.1.1503 (Core) 
[root@centos7-bin ~]# uname -r
3.10.0-123.20.1.el7.x86_64
```

```text:Dockerインストール
[root@centos7-bin ~]# wget https://get.docker.com/builds/Linux/x86_64/docker-latest -O docker
[root@centos7-bin ~]# chmod +x docker
[root@centos7-bin ~]# ./docker -d &
```

```text:Dockerの状態
[root@centos7-bin ~]# ./docker version
Client version: 1.5.0
Client API version: 1.17
Go version (client): go1.4.1
Git commit (client): a8a31ef
OS/Arch (client): linux/amd64
Server version: 1.5.0
Server API version: 1.17
Go version (server): go1.4.1
Git commit (server): a8a31ef

[root@centos7-bin ~]# ./docker info
Containers: 0
Images: 0
Storage Driver: devicemapper
 Pool Name: docker-202:2-336031-pool
 Pool Blocksize: 65.54 kB
 Backing Filesystem: extfs
 Data file: /dev/loop0
 Metadata file: /dev/loop1
 Data Space Used: 307.2 MB
 Data Space Total: 107.4 GB
 Metadata Space Used: 729.1 kB
 Metadata Space Total: 2.147 GB
 Udev Sync Supported: false
 Data loop file: /var/lib/docker/devicemapper/devicemapper/data
 Metadata loop file: /var/lib/docker/devicemapper/devicemapper/metadata
 Library Version: 1.02.82-git (2013-10-04)
Execution Driver: native-0.2
Kernel Version: 3.10.0-123.20.1.el7.x86_64
Operating System: CentOS Linux 7 (Core)
CPUs: 1
Total Memory: 988.9 MiB
Name: centos7-bin
ID: QWYU:SFTX:JGM3:66C2:TAIQ:YBRL:D24N:TY6H:FIJU:42KH:BYXC:TGKZ

[root@centos7-bin ~]# lsblk 
NAME                       MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
loop0                        7:0    0  100G  0 loop 
└─docker-202:2-336031-pool 253:0    0  100G  0 dm   
loop1                        7:1    0    2G  0 loop 
└─docker-202:2-336031-pool 253:0    0  100G  0 dm   

[root@centos7-bin ~]# ls -alhs /var/lib/docker/devicemapper/devicemapper/data 
293M -rw------- 1 root root 100G  4月  6 23:36 /var/lib/docker/devicemapper/devicemapper/data
```

## CentOS 6.6 - yum

```text:カーネルのバージョン
[root@centos6-yum ~]# yum update -y
[root@centos6-yum ~]# cat /etc/redhat-release 
CentOS release 6.6 (Final)
[root@centos6-yum ~]# uname -r
2.6.32-504.8.1.el6.x86_64
```

```text:Dockerインストール
[root@centos6-yum ~]# rpm -ivh http://ftp.jaist.ac.jp/pub/Linux/Fedora/epel/6/i386/epel-release-6-8.noarch.rpm
[root@centos6-yum ~]# yum update -y
[root@centos6-yum ~]# yum install docker-io -y
[root@centos6-yum ~]# service docker start
```

```text:Dockerの状態
[root@centos6-yum ~]# docker version 
Client version: 1.4.1
Client API version: 1.16
Go version (client): go1.3.3
Git commit (client): 5bc2ff8/1.4.1
OS/Arch (client): linux/amd64
Server version: 1.4.1
Server API version: 1.16
Go version (server): go1.3.3
Git commit (server): 5bc2ff8/1.4.1

[root@centos6-yum ~]# docker info
Containers: 0
Images: 0
Storage Driver: devicemapper
 Pool Name: docker-202:2-90423-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: 305.7 MB
 Data Space Total: 107.4 GB
 Metadata Space Used: 729.1 kB
 Metadata Space Total: 2.147 GB
 Library Version: 1.02.89-RHEL6 (2014-09-01)
Execution Driver: native-0.2
Kernel Version: 2.6.32-504.8.1.el6.x86_64
Operating System: <unknown>
CPUs: 1
Total Memory: 992.4 MiB
Name: centos6-yum.tech-sketch.jp
ID: 4GFY:54BF:AG5P:TJPY:BANH:56DC:5MJ4:KS7K:UR6P:K2GX:VDTS:KAYU

[root@centos6-yum ~]# lsblk 
NAME                               MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
loop0                                7:0    0  100G  0 loop 
└─docker-202:2-90423-pool (dm-0)   253:0    0  100G  0 dm   
  └─docker-202:2-90423-base (dm-1) 253:1    0   10G  0 dm   
loop1                                7:1    0    2G  0 loop 
└─docker-202:2-90423-pool (dm-0)   253:0    0  100G  0 dm   
  └─docker-202:2-90423-base (dm-1) 253:1    0   10G  0 dm   

[root@centos6-yum ~]# ls -alhs /var/lib/docker/devicemapper/devicemapper/data 
292M -rw------- 1 root root 100G  4月  6 20:12 2015 /var/lib/docker/devicemapper/devicemapper/data
```

## CentOS 6.6 - binary

```text:カーネルのバージョン
[root@centos6-bin ~]# yum update -y
[root@centos6-bin ~]# cat /etc/redhat-release 
CentOS release 6.6 (Final)
[root@centos6-bin ~]# uname -r
2.6.32-504.8.1.el6.x86_64
```

```text:Dockerインストール
[root@centos6-bin ~]# rpm -ivh http://ftp.jaist.ac.jp/pub/Linux/Fedora/epel/6/i386/epel-release-6-8.noarch.rpm
[root@centos6-bin ~]# yum update -y
[root@centos6-bin ~]# wget https://get.docker.com/builds/Linux/x86_64/docker-latest -O docker
[root@centos6-bin ~]# chmod +x docker
[root@centos6-bin ~]# ./docker -d &
```

```text:Dockerの状態
[root@centos6-bin ~]# ./docker version
Client version: 1.5.0
Client API version: 1.17
Go version (client): go1.4.1
Git commit (client): a8a31ef
OS/Arch (client): linux/amd64
Server version: 1.5.0
Server API version: 1.17
Go version (server): go1.4.1
Git commit (server): a8a31ef

[root@centos6-bin ~]# ./docker info
Containers: 0
Images: 0
Storage Driver: devicemapper
 Pool Name: docker-202:2-90374-pool
 Pool Blocksize: 65.54 kB
 Backing Filesystem: extfs
 Data file: /dev/loop0
 Metadata file: /dev/loop1
 Data Space Used: 305.7 MB
 Data Space Total: 107.4 GB
 Metadata Space Used: 729.1 kB
 Metadata Space Total: 2.147 GB
 Udev Sync Supported: false
 Data loop file: /var/lib/docker/devicemapper/devicemapper/data
 Metadata loop file: /var/lib/docker/devicemapper/devicemapper/metadata
 Library Version: 1.02.82-git (2013-10-04)
Execution Driver: native-0.2
Kernel Version: 2.6.32-504.8.1.el6.x86_64
Operating System: <unknown>
CPUs: 1
Total Memory: 992.4 MiB
Name: centos6-bin.tech-sketch.jp
ID: IQSO:CR4U:XCAF:ANBK:L4QW:CUBB:LHFB:F2PK:YVJA:MZNM:NOKX:DNSI
WARNING: No memory limit support
WARNING: No swap limit support

[root@centos6-bin ~]# lsblk 
NAME                               MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
loop0                                7:0    0  100G  0 loop 
└─docker-202:2-90374-pool (dm-0)   253:0    0  100G  0 dm   
  └─docker-202:2-90374-base (dm-1) 253:1    0   10G  0 dm   
loop1                                7:1    0    2G  0 loop 
└─docker-202:2-90374-pool (dm-0)   253:0    0  100G  0 dm   
  └─docker-202:2-90374-base (dm-1) 253:1    0   10G  0 dm   

[root@centos6-bin ~]# ls -alhs /var/lib/docker/devicemapper/devicemapper/data 
292M -rw------- 1 root root 100G  4月  6 23:49 2015 /var/lib/docker/devicemapper/devicemapper/data
```

## Ubuntu 14.04 - apt

```text:カーネルのバージョン
root@ubuntu1404-apt:~# apt-get update
root@ubuntu1404-apt:~# apt-get upgrade -y
root@ubuntu1404-apt:~# cat /etc/lsb-release 
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=14.04
DISTRIB_CODENAME=trusty
DISTRIB_DESCRIPTION="Ubuntu 14.04.1 LTS"
root@ubuntu1404-apt:~# cat /etc/debian_version 
jessie/sid
root@ubuntu1404-apt:~# uname -r
3.13.0-45-generic
```

```text:Dockerインストール
root@ubuntu1404-apt:~# apt-get update
root@ubuntu1404-apt:~# apt-get install docker.io -y
```

```text:Dockerの状態
root@ubuntu1404-apt:~# docker version
Client version: 1.0.1
Client API version: 1.12
Go version (client): go1.2.1
Git commit (client): 990021a
Server version: 1.0.1
Server API version: 1.12
Go version (server): go1.2.1
Git commit (server): 990021a

root@ubuntu1404-apt:~# docker info
Containers: 0
Images: 0
Storage Driver: devicemapper
 Pool Name: docker-202:2-1266030-pool
 Data file: /var/lib/docker/devicemapper/devicemapper/data
 Metadata file: /var/lib/docker/devicemapper/devicemapper/metadata
 Data Space Used: 291.5 Mb
 Data Space Total: 102400.0 Mb
 Metadata Space Used: 0.7 Mb
 Metadata Space Total: 2048.0 Mb
Execution Driver: native-0.2
Kernel Version: 3.13.0-45-generic
WARNING: No swap limit support

root@ubuntu1404-apt:~# lsblk 
NAME                                 MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
loop0                                  7:0    0   100G  0 loop 
`-docker-202:2-1266030-pool (dm-0)   252:0    0   100G  0 dm   
  `-docker-202:2-1266030-base (dm-1) 252:1    0    10G  0 dm   
loop1                                  7:1    0     2G  0 loop 
`-docker-202:2-1266030-pool (dm-0)   252:0    0   100G  0 dm   
  `-docker-202:2-1266030-base (dm-1) 252:1    0    10G  0 dm   

root@ubuntu1404-apt:~# ls -alhs /var/lib/docker/devicemapper/devicemapper/data 
291M -rw------- 1 root root 100G Apr  6 22:49 /var/lib/docker/devicemapper/devicemapper/data
```

## Ubuntu 14.04 - install script

```text:カーネルのバージョン
root@ubuntu1404-wget:~# apt-get update
root@ubuntu1404-wget:~# apt-get upgrade -y
root@ubuntu1404-wget:~# cat /etc/lsb-release 
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=14.04
DISTRIB_CODENAME=trusty
DISTRIB_DESCRIPTION="Ubuntu 14.04.1 LTS"
root@ubuntu1404-wget:~# cat /etc/debian_version 
jessie/sid
root@ubuntu1404-wget:~# uname -r
3.13.0-45-generic
```

```text:Dockerインストール
root@ubuntu1404-wget:~# wget -qO- https://get.docker.com/ | sh
```

```text:Dockerの状態
root@ubuntu1404-wget:~# docker version
Client version: 1.5.0
Client API version: 1.17
Go version (client): go1.4.1
Git commit (client): a8a31ef
OS/Arch (client): linux/amd64
Server version: 1.5.0
Server API version: 1.17
Go version (server): go1.4.1
Git commit (server): a8a31ef

root@ubuntu1404-wget:~# docker info
Containers: 0
Images: 0
Storage Driver: aufs
 Root Dir: /var/lib/docker/aufs
 Backing Filesystem: extfs
 Dirs: 0
Execution Driver: native-0.2
Kernel Version: 3.13.0-45-generic
Operating System: Ubuntu 14.04.2 LTS
CPUs: 1
Total Memory: 990 MiB
Name: ubuntu1404-wget
ID: GYZK:P5SD:US2E:UK7X:AQK6:YZH7:IGQ3:HW34:FHQF:PY4B:7FQQ:PLAO
WARNING: No swap limit support
```

## Ubuntu 12.04 - install script

```text:デフォルトのカーネルのバージョン
root@ubuntu1204-wget:~# cat /etc/lsb-release 
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=12.04
DISTRIB_CODENAME=precise
DISTRIB_DESCRIPTION="Ubuntu 12.04.5 LTS"
root@ubuntu1204-wget:~# cat /etc/debian_version 
wheezy/sid
root@ubuntu1204-wget:~# uname -r
3.2.0-75-virtual
```

```text:Dockerインストール
root@ubuntu1204-wget:~# apt-get update
root@ubuntu1204-wget:~# apt-get install linux-image-generic-lts-trusty -y
root@ubuntu1204-wget:~# reboot
root@ubuntu1204-wget:~# uname -r
3.13.0-48-generic
root@ubuntu1204-wget:~# wget -qO- https://get.docker.com/ | sh
```

```text:Dockerの状態
root@ubuntu1204-wget:~# docker version
Client version: 1.5.0
Client API version: 1.17
Go version (client): go1.4.1
Git commit (client): a8a31ef
OS/Arch (client): linux/amd64
Server version: 1.5.0
Server API version: 1.17
Go version (server): go1.4.1
Git commit (server): a8a31ef

root@ubuntu1204-wget:~# docker info
Containers: 0
Images: 0
Storage Driver: aufs
 Root Dir: /var/lib/docker/aufs
 Backing Filesystem: extfs
 Dirs: 0
Execution Driver: native-0.2
Kernel Version: 3.13.0-48-generic
Operating System: Ubuntu precise (12.04.5 LTS)
CPUs: 1
Total Memory: 989.7 MiB
Name: ubuntu1204-apt
ID: SGPL:P46W:PTGY:EU6H:7QWR:JHQD:KJT2:26F4:IAQ3:FG6O:O5RN:KW7N
WARNING: No swap limit support
```

## Debian 7.8 - install script

```text:カーネルのバージョン
root@debian7-wget:~# cat /etc/debian_version 
7.8
root@debian7-wget:~# uname -r
3.2.0-4-amd64
```

```text:Dockerインストール
root@debian7-wget:~# echo 'deb http://http.debian.net/debian wheezy-backports main' >> /etc/apt/sources.list
root@debian7-wget:~# apt-get update
root@debian7-wget:~# apt-get install -t wheezy-backports linux-image-amd64 -y
root@debian7-wget:~# wget -qO- https://get.docker.com/ | sh
```

```text:Dockerの状態
root@debian7-wget:~# docker version
Client version: 1.5.0
Client API version: 1.17
Go version (client): go1.4.1
Git commit (client): a8a31ef
OS/Arch (client): linux/amd64
Server version: 1.5.0
Server API version: 1.17
Go version (server): go1.4.1
Git commit (server): a8a31ef

root@debian7-wget:~# docker info
Containers: 0
Images: 0
Storage Driver: aufs
 Root Dir: /var/lib/docker/aufs
 Backing Filesystem: extfs
 Dirs: 0
Execution Driver: native-0.2
Kernel Version: 3.2.0-4-amd64
Operating System: Debian GNU/Linux 7 (wheezy)
CPUs: 1
Total Memory: 998.9 MiB
Name: debian7-apt
ID: EQJA:MW5M:BHKH:UHIE:D7GT:LTTC:IMO2:SJVG:B3E2:TF23:OSUG:KAVA
WARNING: No memory limit support
WARNING: No swap limit support
```