When inspecting the filesystem of a docker container I used
df -h to check filesystem from the point of view of the container:
$ docker run -it busybox sh / # df -h Filesystem Size Used Available Use% Mounted on overlay 97.8G 78.7G 14.1G 85% / tmpfs 64.0M 0 64.0M 0% /dev tmpfs 7.8G 0 7.8G 0% /sys/fs/cgroup /dev/sda2 97.8G 78.7G 14.1G 85% /etc/resolv.conf /dev/sda2 97.8G 78.7G 14.1G 85% /etc/hostname /dev/sda2 97.8G 78.7G 14.1G 85% /etc/hosts shm 64.0M 0 64.0M 0% /dev/shm tmpfs 64.0M 0 64.0M 0% /proc/kcore tmpfs 64.0M 0 64.0M 0% /proc/timer_list tmpfs 64.0M 0 64.0M 0% /proc/sched_debug tmpfs 7.8G 0 7.8G 0% /proc/scsi tmpfs 7.8G 0 7.8G 0% /sys/firmware
What I see when I run
df -h on my actual host is:
$ df -h Filesystem Size Used Avail Use% Mounted on udev 7.8G 0 7.8G 0% /dev tmpfs 1.6G 9.6M 1.6G 1% /run /dev/sda2 98G 79G 15G 85% / tmpfs 7.8G 82M 7.8G 2% /dev/shm tmpfs 5.0M 4.0K 5.0M 1% /run/lock tmpfs 7.8G 0 7.8G 0% /sys/fs/cgroup /dev/sda3 108G 34G 75G 31% /dev/sda5 /dev/sda1 511M 32M 480M 7% /boot/efi tmpfs 1.6G 56K 1.6G 1% /run/user/1000
It is not surprising that there are extra other filesystems mounted in the container by docker engine, however, I did not expect the container to be able to see /dev/sda2 and it's usage. Can you explain such behaviour as I have not attached any volumes? I expected the container to have an isolated view of the host not to be able to "see" some of its filesystems.