Docker Community Forums

Share and learn in the Docker community.

Increase container volume(disk) size

Hi,

Can someone please let me know how to increase the volume(disk) size of container ?.

Once I deployed the container, I just look at the disk space allocated to docker. Just 10GB has allocated to this. Is there any option to set the disk size to 100GB? . I have 1TB Hard disk size

[root@fa10q3907qab ~]# df -h
Filesystem Size Used Avail Use% Mounted on
rootfs 9.8G 878M 8.4G 10% /

Thanks.

Please someone help me on this. Still I’m wondering to get my problem resolved completely

Read https://jpetazzo.github.io/2014/01/29/docker-device-mapper-resize/ and the more recent http://jpetazzo.github.io/assets/2015-03-03-not-so-deep-dive-into-docker-storage-drivers.html#1

With Centos 7 I did the following to increase the default size of the containers

Modify the docker config in /etc/sysconfig/docker-storage to add the line:
DOCKER_STORAGE_OPTIONS= - -storage-opt dm.basesize=20G
service docker stop
rm /var/lib/docker NOTE THIS DELETES ALL IMAGES etc. SO MAKE A BACKUP
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.

With respect to resizing existing containers, I am not able to get the resize2fs command to succeed.

Can anyone shed additional light on this?

I have installed docker on Linux machine. Then i pulled an image of Red Hat Linux 7. I tried the above approach but was unable to increase the size. Does anyone have any idea regarding this?

I am wondering if you could give me some pointerss on a docker issue that I am facing. I am trying to increase the default fs size for containers created on OEL 7.1/docker 1.6.1 combination. I have tried setting

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

in /etc/sysconfig/docker-storage

and also followed the instructions on the below link for reseting the sparse file size

https://jpetazzo.github.io/2014/01/29/docker-device-mapper-resize/

but even after the above, my ‘docker info’ is showing 'Data Space Total: 107.4 GB’ and new container’s default size is 10G. Any pointers?.

–storage-driver=devicemapper --storage-opt dm.basesize=20G

No such file. No such file.

Hi
I am using docker 17.05.0-c ubuntu 16.04
/etc/sysconfig/docker-storage this file does now exist

Does anyone know how to resize the docker volume?

Just create it. i did it, restarted docker and worked

I have had hell understanding the resize2fs.
that’s how I got it working :

First, my context is as follow :
I store my container’s volume in a file image.
Then I try to resize it.

#make a 2GB file that will be used as a filesystem
truncate -s 2G my_fs

# format file as an ext4 filesystem
mkfs.ext4 ./my_fs

# mount the filesystem in my_dir
mkdir ./my_dir
sudo mount -o loop ./my_fs  ./my_dir

my_dir can now be mounted in a docker container using the volume option

if the container is running out of space
pause the container with docker container pause 0123456789

first, find the loop device where my_dir is mounted:
lsblk

then

#add 3GB to the filesystem
truncate -s +3G 

sudo partprobe -s /dev/loop0
sudo losetup -c /dev/loop0

# check the size of the partition : 
sudo fdisk -l /dev/loop0

#resize the filesystem :
sudo resize2fs /dev/loop0

#check the new size
df -h /dev/loop0

#voila !!

now unpause the container with docker container unpause 0123456789

just upgrade to overlay2!

Can you please explain why overlay2 is the better system? I have overlay2 enabled with WSL.

Do you know if this means there is no default size limit on disk images with overlay2 storage?