I am trying to understand how I can increase the available space docker offers to the containers.

TL;DR - How can I attribute more hard disk space to docker containers?

My core system:

docker info
Containers: 15
 Running: 12
 Paused: 0
 Stopped: 3
Images: 19
Server Version: 17.06.2-ce
Storage Driver: overlay2
 Backing Filesystem: extfs
 Supports d_type: true
 Native Overlay Diff: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
 Volume: local
 Network: bridge host macvlan null overlay
 Log: awslogs fluentd gcplogs gelf journald json-file logentries splunk syslog
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 6e23458c129b551d5c9871e5174f6b1b7f6d1170
runc version: 810190ceaa507aa2727d7ae6f4790c76ec150bd2
init version: 949e6fa
Security Options:
  Profile: default
Kernel Version: 4.9.58-xxxx-std-ipv6-64
Operating System: Debian GNU/Linux 9 (stretch)
OSType: linux
Architecture: x86_64
CPUs: 4
Total Memory: 7.625GiB
Name: ns3306175
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Registry: https://index.docker.io/v1/
Experimental: false
Insecure Registries:
Live Restore Enabled: false

WARNING: No cpu cfs quota support
WARNING: No cpu cfs period support

Running df -h

/dev/root        20G  5.9G   13G  33% /
devtmpfs        3.9G     0  3.9G   0% /dev
tmpfs           3.9G     0  3.9G   0% /dev/shm
tmpfs           3.9G  404M  3.5G  11% /run
tmpfs           5.0M     0  5.0M   0% /run/lock
tmpfs           3.9G     0  3.9G   0% /sys/fs/cgroup
/dev/sda2       487M   24M  435M   6% /boot
/dev/sda4       1.8T   68M  1.7T   1% /home
overlay          20G  5.9G   13G  33% /var/lib/docker/overlay2/af4736dc572f48a34fd13bfd9c139358fefbbd79c8bd26716b26ba9dd2fe894d/merged
shm              64M     0   64M   0% /var/lib/docker/containers/c5b5bd3ebcf6a45558aa995711f4e2678582cbf7b21a11c087965de2a5a1c34/shm .. and more

My idea now - I want to have the sda4 space available in my containers. If I spawn a container and df -h I only have access to:

overlay          20G  5.9G   13G  33% /
tmpfs           3.9G     0  3.9G   0% /dev
tmpfs           3.9G     0  3.9G   0% /sys/fs/cgroup
/dev/root        20G  5.9G   13G  33% /etc/hosts
shm              64M     0   64M   0% /dev/shm
tmpfs           3.9G     0  3.9G   0% /sys/firmware

1 Answer 1


You could move the docker directory to somewhere under /home and create a symlink /var/lib/docker pointing to the new location. For example:

### shut down docker first
systemctl stop docker

mv /var/lib/docker /home/
ln -s /home/docker/ /var/lib/

### restart docker now
systemctl start docker

Use another directory if /home/docker already exists.

Instead of, or as well as, the symlink from /var/lib/docker -> /home/docker, you could also reconfigure docker so that it expects to find its directory under /home rather than /var/lib.

  • Hello cas, thanks for your reply. I thought about this too - but putting symlinks feels not a good practice. I am thinking about doing it by using the docker storage driver - docs.docker.com/engine/userguide/storagedriver/… .. Did you think about this? Jan 3, 2018 at 12:31
  • "move and symlink" is perfectly normal practice, nothing at all bad about it. As is "move and reconfigure" (personally, I tend to do both: mv the data, reconfigure the daemon to look in the new location, and make a symlink so that scripts etc which expect data to be in the old location can still find it). The device-mapper storage driver looks like it's a wrapper around LVM...so unless you're already using LVM (and it doesn't look like you are), you won't be able to use without doing a backup/repartition/reformat/restore of sda (or, at least. your /home partition).
    – cas
    Jan 3, 2018 at 13:12
  • Hello Cas, thanks again for the assistance! I think you are right that the effort of "setup" lvm "just" for this might be overhead. I will try your solution! Jan 3, 2018 at 18:12
  • After a very long detour, finally stumbled upon this answer and it fixed my issue. (basically I was searching for the answer to 'how to expand disk space for my docker image', while it was actually my host partition that was hosed) Jan 17, 2022 at 23:22

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .