F4ll0ut
F4ll0ut

Reputation: 309

Increase Docker container storage size on CentOS

I want to increase the disk space of a Docker container. Here is the output from docker info.

Containers: 3
Running: 3
Paused: 0
Stopped: 0
Images: 4
Server Version: 19.03.5
Storage Driver: overlay2
Backing Filesystem: extfs 
Supports d_type: true
Native Overlay Diff: true

I have read that the disk space is 10GB by default, supposedly this limit is dropped with overlay2. This does not seem to be the case for me.

docker run -d --name jd2 --restart always  -v $HOME/docker/volumes/jd2:/opt/JDownloader/cfg -v $HOME/downloads:/opt/JDownloader/Downloads plusminus/jdownloader2-headless

Upvotes: 2

Views: 6938

Answers (2)

larsks
larsks

Reputation: 312838

I have read that the disk space is 10GB by default, supposedly this limit is dropped with overlay2. This does not seem to be the case for me.

That is not accurate.

Earlier releases of Docker used the devicemapper storage driver on CentOS, which creates a new virtual block device for each container. In this case, the default per-container size was 10GB, and could be controlled by the dm.basesize storage option.

Thanks to kernel updates and additional development work, the default storage driver on CentOS and most other distributions is the overlay2 storage driver. This no longer relies on a per-container block device, and instead makes use of overlayfs. One of the practical impacts of this is that there is no longer a per-container storage limit: all containers have access to all the space under /var/lib/docker. There is no longer any sort of per-container 10GB limit.

See the documentation for more information about the overlay2 storage driver.

If you are running out of space in /var/lib/docker, you can add space as you would for any other filesystem.

Upvotes: 4

Yash Kamdar
Yash Kamdar

Reputation: 131

Please follow the steps below to increase the default size of a docker container -

#Modify the docker config in /etc/sysconfig/docker-storage to add the line:
DOCKER_STORAGE_OPTIONS= - -storage-opt dm.basesize=20G

# Stop the docker service
service docker stop

rm /var/lib/docker 
#NOTE THIS DELETES ALL IMAGES , SO MAKE A BACKUP

# Restart the docker service 
service docker start

docker load < [each_save_in_backup.tar]
docker run -i -t [imagename] /bin/bash

In the bash prompt of the docker container “df -k” should show 20GB / file system 
size now.

Let me know if this doesnt help .

Upvotes: 0

Related Questions