CentOS7 で docker を動かすと storage driver として devicemapper が使われるが、aufs を使えるようにしたメモ。
<参考>
- aufs-backed docker host on centos6 - blog.hansode.org CentOS6の方はこちら
- CentOS7(RHEL7) デフォルトで起動するkernelを変更するには
- https://github.com/bnied/rhel-aufs-kernel
ちなみに、なんでそんなことをしたいのかと言うと、drone で docker の storage driver に devicemapper (デフォルト)を使うとビルドが起動するまでに時間がかかる issue があるようで、aufs への切り替えが推奨されていたため。実際すぐ起動するようになった。> https://github.com/drone/drone/issues/271
aufs 対応 kernel を入れる
https://github.com/bnied/rhel-aufs-kernel で配布してくれている aufs 対応 kernel を入れる
rpm -Uvh https://yum.spaceduck.org/rhel-aufs-kernel/7/x86_64/kernel-ml-aufs-3.19.8-1.el7.centos.x86_64.rpm
起動するカーネルの選択
CentOS7 は grub2 を使っているので、grub2-set-default
コマンドを使って設定する。
$ grep ^menuentry /boot/grub2/grub.cfg
menuentry 'CentOS Linux (3.19.8-1.el7.centos.x86_64) 7 (Core)' --class rhel fedora --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-3.10.5-3.el6.x86_64-advanced-aa16c27c-9b7f-4d02-a899-f1fe4dc7cd77' {
menuentry 'CentOS Linux (3.19.8-1.el7.centos.x86_64) 7 (Core) with debugging' --class rhel fedora --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-3.10.5-3.el6.x86_64-advanced-aa16c27c-9b7f-4d02-a899-f1fe4dc7cd77' {
menuentry 'CentOS Linux 7 (Core), with Linux 3.10.0-229.el7.x86_64' --class rhel fedora --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-3.10.0-229.el7.x86_64-advanced-aa16c27c-9b7f-4d02-a899-f1fe4dc7cd77' {
menuentry 'CentOS Linux 7 (Core), with Linux 0-rescue-4627da230679477086e4995bae995b57' --class rhel fedora --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-0-rescue-4627da230679477086e4995bae995b57-advanced-aa16c27c-9b7f-4d02-a899-f1fe4dc7cd77' {
kernel-ml-aufs は一番上のものようなので、そちらを使って boot するように選択する
grub2-set-default 'CentOS Linux (3.19.8-1.el7.centos.x86_64) 7 (Core)'
cp /boot/grub2/grub.cfg /boot/grub2/grub.cfg.orig
grub2-mkconfig -o /boot/grub2/grub.cfg
reboot
reboot
カーネルバージョンが選択したものになっていることを確認
$ uname -a
Linux xxxxxxx 3.19.8-1.el7.centos.x86_64 #1 SMP Mon May 25 22:45:44 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
$ cat /etc/redhat-release
CentOS Linux release 7.1.1503 (Core)
docker の設定
/etc/sysconfig/docker
other_args="-s aufs"
再起動
systemctl restart docker
aufs になってるか確認
# docker info
Containers: 0
Images: 0
Storage Driver: aufs