Linux
fedora
Docker
xfs
atomichost

失敗:Docker on Fedora Atomic hostで特定コンテナの容量制限を柔軟に行ってみた

今までのデータは消えるでしょう。結果として失敗。


環境

Kernel Version: 4.20.15-200.fc29.x86_64

Operating System: Fedora 29.20190318.0 (Atomic Host)

[root@localhost core]# docker info

Containers: 0
Running: 0
Paused: 0
Stopped: 0
Images: 0
Server Version: 1.13.1
Storage Driver: overlay2
Backing Filesystem: xfs
Supports d_type: true


インストール直後でのテスト

[root@localhost core]# docker run --storage-opt size=5g -t -i ubuntu /bin/bash

Unable to find image 'ubuntu:latest' locally
Trying to pull repository docker.io/library/ubuntu ...
sha256:017eef0b616011647b269b5c65826e2e2ebddbe5d1f8c1e56b3599fb14fabec8: Pulling from docker.io/library/ubuntu
898c46f3b1a1: Pull complete
63366dfa0a50: Pull complete
041d4cd74a92: Pull complete
6e1bee0f8701: Pull complete
Digest: sha256:017eef0b616011647b269b5c65826e2e2ebddbe5d1f8c1e56b3599fb14fabec8
Status: Downloaded newer image for docker.io/ubuntu:latest
/usr/bin/docker-current: Error response from daemon: --storage-opt is supported only for overlay over xfs with 'pquota' mount option.
See '/usr/bin/docker-current run --help'.

sudo vi /etc/default/grub

GRUB_CMDLINE_LINUX= に「 rootflags=uquota,gquota,pquota 」を追記してください。

sudo grub2-mkconfig -o /boot/grub2/grub.cfg

sudo reboot

で適用できたが、だめ。


2

vi /etc/sysconfig/docker-storage-setup

STORAGE_DRIVER=overlay とする

service docker stop

atomic storage reset
service docker start

だめ


別ディスクを作成、fstabでpquotaを。

fdisk /dev/sdc

n Enter... w
mkfs -t xfs /dev/sdc1
vi /etc/fstab
/dev/sdc1 /var/lib/docker xfs defaults,pquota 0 0
service docker stop
#エラー防止
umount -a
atomic storage reset
service docker start

だめでした


まとめ

XFSでquotaは難しそう。


Ref

https://www.server-memo.net/centos-settings/system/quota_xfs.html

https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux_atomic_host/7/html/managing_containers/managing_storage_with_docker_formatted_containers

https://qiita.com/a-killer-bee/items/564d51034c125d192df3


See Also

https://qiita.com/haniokasai/items/2b7a1889e4930b7682c9