Select Page

Increase docker container size easily with these simple steps

Increase docker container size easily with these simple steps

Docker containers can be used for multiple purposes such as application deployment or service hosting. The number of containers that can be hosted in a machine depends on the total disk space available.

For cost-effective hosting purposes, it is often required to restrict the individual docker container size. This limitation is also useful to ensure that a single user do not use up the entire disk space in the host machine.

Setup and manage your Docker system


A sneak-peak into Docker storage drivers

The feature to limit container size is only supported in Devicemapper storage and not by other storage drivers of Docker. In Docker, the storage drivers are responsible for managing the container’s filesystem.

The storage drivers supported by Docker for its containers are Devicemapper, Overlay, AUFS, BTRFS and ZFS. You can choose the driver during Docker installation and change it later on, if required.

This storage driver is applicable for all the containers in that host. To know the storage driver used for your Docker, you can use the command ‘docker info’.


Docker container size with Devicemapper storage driver

Docker containers with Devicemapper storage driver


[ Are your spending too much time managing your Docker containers? Our Docker experts take care of your infrastructure and ensure its smooth functioning. ]

What are the default Docker container size limits?

In Docker, there is a storage pool where the Docker containers are created. While using Defaultmapper storage, the storage pool size that is created is of default size 100 GB, as shown in the ‘Data Space Total‘ field in ‘docker info’.

Likewise, there is a default limit of 10 GB size set for the containers. This is the maximum size up to which a container can grow, and is defined by the parameter ‘Base Device Size‘. Increasing the container size limit is possible, as long as its within the pool limit.

When this default limit for docker container size is increased in Docker, it will impact the size all newly created containers. It is also possible to increase the storage pool size to above 100GB.

Here, we’ll see how to configure devicemapper storage option to set the container size and storage pool limits in Docker.

Increase default limits for docker container size and storage pool

Over time, it is probable that the disk space allotted to your docker containers is not sufficient for your business purposes. You may also want to increase the size of the storage pool so that you can create more containers for your growing business needs.

To increase the docker container size limits, the first requirement is to have enough disk space in the host machine.

Suppose you have enough space in /var partition and you need to increase storage pool size and docker container size limit. Here’s how to do it:

How to increase Docker storage pool size limit

To increase the overall storage pool size of Docker machine, follow these steps:

1. Backup all the existing Docker containers and images that you need and copy them to an external location.

2. Stop the Docker daemon.

3. Clear the current Docker default directory, which will delete all existing containers and images.

4. Create the storage directory “/var/lib/docker/devicemapper/devicemapper”.

5. Create the storage pool with your required new size, say 300 GB using the command:

dd if=/dev/zero of=/var/lib/docker/devicemapper/devicemapper/data bs=1G count=0 seek=300

6. Restart the Docker daemon with Devicemapper storage driver support.

7. Confirm the new storage pool size from the ‘Data Space Total’ in ‘docker info’.

How to increase Docker container size limit

The minimum size of docker containers is 10 GB and its not possible to decrease it further. But you can increase the docker container size from 10 GB it to a higher value, say 20 GB, with these steps:

1. Stop the Docker daemon after taking backup of existing containers and images.

2. Reset the Docker default directory.

3. Start Docker service with the parameter ‘dm.basesize’ set for the new value for Docker container size limit.

dockerd --storage-opt dm.basesize=20G

The newly created containers will now have their size limits set to 20 GB.

[ Running a Docker infrastructure doesn’t have to be hard, or costly. Get world class Docker management services at affordable pricing. ]

Do you provide Docker hosting services?

Wish you had more time to focus on your business? Let us help you.

Our engineers will assist you to setup, monitor and manage your Docker infrastructure 24/7.


Submit a Comment

Your email address will not be published. Required fields are marked *

Bobcares is a server management company that helps businesses deliver uninterrupted and secure online services. Our engineers manage close to 51,500 servers that include virtualized servers, cloud infrastructure, physical server clusters, and more.