CentOS 7ではDockerをフル機能で利用することが可能です。
EPELレポジトリを有効にする
DockerはEPELレポジトリに含まれています。CentOS 7用のEPELレポジトリは現在ベータながら、すでに用意されています。
インストールするコマンドは次の通りです。
$ sudo yum install http://linux.mirrors.es.net/fedora-epel/beta/7/x86_64/epel-release-7-0.2.noarch.rpm
Dockerをインストールする
Dockerのパッケージ名は、docker-ioです。これをyumでインストールします。
$ sudo yum install docker-io
インストールした後に、サービスとして起動させるには systemctl start、ブート時に自動的にサービスを起動させるには systemctl enable を使います。
$ sudo systemctl start docker.service
$ sudo systemctl enable docker.service
これでDockerが利用できる状態になりました。 docker version で確認できます。
$ docker version
Client version: 1.0.0
Client API version: 1.12
Go version (client): go1.2.2
Git commit (client): 63fe64c/1.0.0
Server version: 1.0.0
Server API version: 1.12
Go version (server): go1.2.2
Git commit (server): 63fe64c/1.0.0
また、docker infoで、device mapperを利用していることが確認できます。
$ docker info
Containers: 3
Images: 1
Storage Driver: devicemapper
Pool Name: docker-253:1-23349-pool
Data file: /var/lib/docker/devicemapper/devicemapper/data
Metadata file: /var/lib/docker/devicemapper/devicemapper/metadata
Data Space Used: 465.8 Mb
Data Space Total: 102400.0 Mb
Metadata Space Used: 0.9 Mb
Metadata Space Total: 2048.0 Mb
Execution Driver: native-0.2
Kernel Version: 3.10.0-123.el7.x86_64
以上で、CentOS 7上でDockerを利用できる状態になりました。
参考: インストールのログ
参考のために、Dockerをインストールした時の進み方を貼り付けておきます。
[yuryu@centos7 ~]$ sudo yum install http://linux.mirrors.es.net/fedora-epel/beta/7/x86_64/epel-release-7-0.2.noarch.rpm
Loaded plugins: fastestmirror
epel-release-7-0.2.noarch.rpm | 13 kB 00:00:00
Examining /var/tmp/yum-root-0OMCgR/epel-release-7-0.2.noarch.rpm: epel-release-7-0.2.noarch
Marking /var/tmp/yum-root-0OMCgR/epel-release-7-0.2.noarch.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package epel-release.noarch 0:7-0.2 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
========================================================================================================================
Package Arch Version Repository Size
========================================================================================================================
Installing:
epel-release noarch 7-0.2 /epel-release-7-0.2.noarch 22 k
Transaction Summary
========================================================================================================================
Install 1 Package
Total size: 22 k
Installed size: 22 k
Is this ok [y/d/N]: y
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : epel-release-7-0.2.noarch 1/1
Verifying : epel-release-7-0.2.noarch 1/1
Installed:
epel-release.noarch 0:7-0.2
Complete!
[yuryu@centos7 ~]$ sudo yum install docker-io
Loaded plugins: fastestmirror
base | 3.6 kB 00:00:00
epel/x86_64/metalink | 13 kB 00:00:00
epel | 3.7 kB 00:00:00
extras | 2.9 kB 00:00:00
updates | 2.9 kB 00:00:00
(1/2): epel/x86_64/group_gz | 163 kB 00:00:01
(2/2): epel/x86_64/primary_db | 2.0 MB 00:00:47
Loading mirror speeds from cached hostfile
* base: centos-distro.cavecreek.net
* epel: linux.mirrors.es.net
* extras: centos-distro.cavecreek.net
* updates: mirror.supremebytes.com
Resolving Dependencies
--> Running transaction check
---> Package docker-io.x86_64 0:1.0.0-1.el7 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
========================================================================================================================
Package Arch Version Repository Size
========================================================================================================================
Installing:
docker-io x86_64 1.0.0-1.el7 epel 4.5 M
Transaction Summary
========================================================================================================================
Install 1 Package
Total download size: 4.5 M
Installed size: 23 M
Is this ok [y/d/N]: y
Downloading packages:
docker-io-1.0.0-1.el7.x86_64.rpm | 4.5 MB 00:02:39
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : docker-io-1.0.0-1.el7.x86_64 1/1
Verifying : docker-io-1.0.0-1.el7.x86_64 1/1
Installed:
docker-io.x86_64 0:1.0.0-1.el7
Complete!
[yuryu@centos7 ~]$ sudo systemctl start docker.service
[yuryu@centos7 ~]$ sudo systemctl enable docker.service
ln -s '/usr/lib/systemd/system/docker.service' '/etc/systemd/system/multi-user.target.wants/docker.service'