Search code examples
dockercontainers

<Docker on MacOS> Size of Root file system space made available to container


I am running docker on Mac

$ uname -a
Darwin 19.3.0 Darwin Kernel Version 19.3.0: Thu Jan  9 20:58:23 PST 2020; root:xnu-6153.81.5~1/RELEASE_X86_64 x86_64

$ docker --version
Docker version 19.03.5, build 633a0ea

$ docker images
REPOSITORY                TAG                 IMAGE ID            CREATED             SIZE
ubuntu                    latest              72300a873c2c        3 weeks ago         64.2MB

$ docker run -it ubuntu

root@58a6f17cfe9d:/# df -kh
Filesystem      Size  Used Avail Use% Mounted on
overlay          59G  1.5G   55G   3% /
tmpfs            64M     0   64M   0% /dev
tmpfs           995M     0  995M   0% /sys/fs/cgroup
shm              64M     0   64M   0% /dev/shm
/dev/sda1        59G  1.5G   55G   3% /etc/hosts
tmpfs           995M     0  995M   0% /proc/acpi
tmpfs           995M     0  995M   0% /sys/firmware
root@58a6f17cfe9d:/#

Question:

Why/how does my ubuntu container show 59G of total space mounted on / ?


Solution

  • The answer is here:

    Docker for Mac documentation

    Disk utilization in Docker for Mac

    Docker Desktop stores Linux containers and images in a single, large “disk image” file in the Mac filesystem. This is different from Docker on Linux, which usually stores containers and images in the /var/lib/docker directory.

    Where is the disk image file?

    To locate the disk image file, select the Docker icon and then Preferences > Resources > Advanced.

    The default size of a container is the entire space allocated to this raw image file.