Docker Community Forums

Share and learn in the Docker community.

How to understand docker container disk space usage?

docker

(Nanxiao) #1

I submitted this issue on SO before, but can’t get reasonable answers, so I re-post it here, thanks!

My host disk space usage is like this:

# df -h
Filesystem             Size  Used Avail Use% Mounted on
/dev/mapper/rhel-root   50G   31G   20G  61% /
devtmpfs               5.8G     0  5.8G   0% /dev
tmpfs                  5.8G   84K  5.8G   1% /dev/shm
tmpfs                  5.8G  9.0M  5.8G   1% /run
tmpfs                  5.8G     0  5.8G   0% /sys/fs/cgroup
/dev/mapper/rhel-home  1.3T  5.4G  1.3T   1% /home
/dev/sda2              497M  212M  285M  43% /boot
/dev/sda1              200M  9.5M  191M   5% /boot/efi
tmpfs                  1.2G   16K  1.2G   1% /run/user/42
tmpfs                  1.2G     0  1.2G   0% /run/user/0

After starting a docker container, the disk usage of this container is like follows:

# docker run -it mstormo/suse bash
606759b37afb:/ # df -h
Filesystem                                                                                           Size  Used Avail Use% Mounted on
rootfs                                                                                                99G  231M   94G   1% /
/dev/mapper/docker-253:0-137562709-606759b37afb809fe9224ac2210252ee1da71f9c0b315ff9ef570ad9c0adb16c   99G  231M   94G   1% /
tmpfs                                                                                                5.8G     0  5.8G   0% /dev
shm                                                                                                   64M     0   64M   0% /dev/shm
tmpfs                                                                                                5.8G     0  5.8G   0% /sys/fs/cgroup
tmpfs                                                                                                5.8G   96K  5.8G   1% /run/secrets
/dev/mapper/rhel-root                                                                                 50G   31G   20G  61% /etc/resolv.conf
/dev/mapper/rhel-root                                                                                 50G   31G   20G  61% /etc/hostname
/dev/mapper/rhel-root                                                                                 50G   31G   20G  61% /etc/hosts
tmpfs                                                                                                5.8G     0  5.8G   0% /proc/kcore
tmpfs                                                                                                5.8G     0  5.8G   0% /proc/timer_stats

I have 2 questions about container disk usage:

(1) The tmpfs and /dev/mapper/rhel-root in container share the same disk/memory space with host directly?

(2) For rootfs of container, where does this file system exist? As printed, it has 99G, so I can use all the 99G disk space?