How to increase the size limit of a docker container?

Refresh

March 2019

Views

0 time

1

Context: I'm under Archlinux, and wanted to create a dockerfile as a reference for users of my program under Ubuntu 16.04 (xenial). It only has an old OpenCV version (2.4) on apt, so I need to compile OpenCV from sources.

Problem: OpenCV compilation creates more than 10G of data, which is the container size limit (visible with df -h), and thus crashes before finishing compilation.

Last failed attempt: I saw that there is a daemon option --storage-opt dm.basesize=20G. So I changed the docker.service line:

# from
ExecStart=/usr/bin/dockerd -H fd://
# to
ExecStart=/usr/bin/dockerd --storage-opt dm.basesize=20G -H fd://

After restarting the daemon service, and pruning all my images and containers, the command docker info now shows "Base Device Size: 21.47GB" instead of some 10GB previously. However, every new container still have a size limit of 10G. The command df -h shows:

[email protected]:/# df -h
Filesystem                                                                                       Size  Used Avail Use% Mounted on
/dev/mapper/docker-8:6-1704110-b5a7ec35a707f478a4a836ff859108092bbe32525d558d4f6661efba91313801   10G  139M  9.9G   2% /
...

Any idea of how I can change this?

1 answers

1

You can do it also with devicemapper storage driver (old example). You just need to remove (docker rmi) and build/pull used Docker images first. Change of storage driver also triggers pulls of all images from the scratch to the filesystem, so that make sense why it was working with overlay2.