Docker container drive does not match available hard drive space on host -
i have loaded new custom image remote redhat 7 docker host instance. when running new container, container not attempt use entire disk. following output of df -h on container:
rootfs 9.8g 9.3g 0 100% / /dev/mapper/docker-253:0-67515990-5700c262a29a5bb39d9747532360bf6a346853b0ab1ca6e5e988d7c8191c2573 9.8g 9.3g 0 100% / tmpfs 1.9g 0 1.9g 0% /dev shm 64m 0 64m 0% /dev/shm /dev/mapper/vg_root-lv_root 49g 25g 25g 51% /etc/resolv.conf /dev/mapper/vg_root-lv_root 49g 25g 25g 51% /etc/hostname /dev/mapper/vg_root-lv_root 49g 25g 25g 51% /etc/hosts tmpfs 1.9g 0 1.9g 0% /proc/kcore tmpfs 1.9g 0 1.9g 0% /proc/timer_stats
but host system has more space:
filesystem size used avail use% mounted on /dev/mapper/vg_root-lv_root 49g 25g 25g 51% / devtmpfs 1.9g 0 1.9g 0% /dev tmpfs 1.9g 0 1.9g 0% /dev/shm tmpfs 1.9g 8.5m 1.9g 1% /run tmpfs 1.9g 0 1.9g 0% /sys/fs/cgroup /dev/mapper/vg_root-lv_home 9.8g 73m 9.7g 1% /home /dev/sda1 497m 96m 402m 20% /boot
it seems if docker assigning 9.8 gigs of /home mapping entire drive of container. wondering if there reason seeing this?
problem
i able resolve problem. issue not related volume being mounted container (ie not mounting home volume root volume on container). problem occurred because docker uses device-mapper in redhat manage file systems of it's containers. default, containers start 10g of space. in general, docker use aufs manage file systems of containers. case on debian based versions of linux, redhat uses device-mapper instead.
solution
luckily, device-mapper size configurable in docker. first, had stop service, , remove of images/containers. (note: there no coming this, backup images needed).
sudo service stop docker && sudo rm -irf /var/lib/docker
then, start docker instance manually desired size parameters:
sudo docker -d --storage-opt dm.basesize=[desired_size]
in case, increased container size 13g:
sudo docker -d --storage-opt dm.basesize=13g
then docker still running, pull/reload desired image, start container, , size should match desired size.
next, set docker systemd service file startup desired container size. required docker service start containers desired size. edited options variable in /etc/sysconfig/docker file. looks this:
options='--selinux-enabled --storage-opt dm.basesize=13g'
finally, restart docker service:
sudo service stop docker
references
[1] https://jpetazzo.github.io/2014/01/29/docker-device-mapper-resize/ - how discovered redhat uses device-mapper, , device-mapper has 10g limit.
[2] https://docs.docker.com/reference/commandline/cli/ - found storage options in dockers documentation.
Comments
Post a Comment