Docker increase disk space

9/9/2015

I have a docker running and it gives me disk space warning. How can i increase the docker space and start again? (The same container)

Lets say I want to give like 15gb.

-- TechnoCorner
docker
kubernetes

5 Answers

10/24/2016

To increase space available for Docker you will have to increase your docker-pool size. If you do a

lvs

You will see the docker-pool logical volume and its size. If your docker pool is sitting on a volume group that has free space you can simply increase the docker-pool LV by

lvextend -l 100%FREE <path_to_lv>
# An example using this may looks like this:
# lvextend -l 100%FREE /dev/VolGroup00/docker-pool

You can check out more docker diskspace tips here

Thanks

-- Vect0r
Source: StackOverflow

9/9/2015

I assume you are talking about disk space to run your containers.

Make sure that you have enough space on whatever disk drive you are using for /var/lib/docker which is the default used by Docker. You can change it with the -g daemon option.

If you don't have enough space you may have to repartition your OS drives so that you have over 15GB. If you are using boot2docker or docker-machine you will have to grow the volume on your Virtual Machine. It will vary depending on what you are using for Virtualization (i.e VirtualBox, VMware, etc)

For example if you are using VirtualBox and docker-machine you can start with something like this for a 40GB VM.

docker-machine create --driver virtualbox --virtualbox-disk-size "40000" default
-- Rico
Source: StackOverflow

12/17/2020

You can also increase disk space through the docker GUIDocker GUI (Mac)

-- K.S.
Source: StackOverflow

8/29/2019

I ran into similar problem with my docker-vm (which is 'alpine-linux' on VMware Fusion in OS X):

 write error: no space left on device alpinevm:/mnt/hgfs
 failed to build: .. no space left on device

.. eventually this guide helped me to resize/expand my docker volume.

TL;DR:

1 - Check size of partition containing /var/lib/docker

> df -h
/dev/sda3                17.6G      4.1G     12.6G  25% /var/lib/docker

look for '/dev/sdaN', where N is your partition for '/var/lib/docker', in my case /dev/sda3

2 - Shut down your VM, open VM Settings > Hard Disk(s) > change size of your 'virtual_disk.vmdk' (or whatever is your machine's virtual disk), then click Apply (see this guide).

3 - Install cfdisk and e2fsprogs-extra which contains resize2fs

> apk add cfdisk
> apk add e2fsprogs-extra

4 - Run cfdisk and resize/expand /dev/sda3

> cfdisk
Device     Boot    Start       End   Sectors   Size  Id Type

/dev/sda1  *        2048    206847    204800   100M  83 Linux
/dev/sda2         206848   4241407   4034560   1.9G  82 Linux swap / Solaris
/dev/sda3        4241408  83886079  79644672  12.6G  83 Linux

[Bootable]  [ Delete ]  [ Resize ]  [  Quit  ]  [  Type  ]  [  Help  ]  [  Write ]  [  Dump  ]

.. press down/up to select '/dev/sda3'

.. press left/right/enter to select 'Resize' -> 'Write' -> 'Quit'

5 - Run resize2fs to expand the file system of /dev/sda3

> resize2fs /dev/sda3

6 - Verify resized volume

> df -h
/dev/sda3                37.3G      4.1G     31.4G  12% /var/lib/docker
-- Alex
Source: StackOverflow

2/27/2017

Docker stores all layers/images in its file formate (i.e. aufs) in default /var/lib/docker directory.

If you are getting disk space warning because of docker then there must of lot of docker images and you need to clean up it.

If you have option to add disk space then can you create separate partition with bigger size and mount your /var/lib/docker over there which will help you to get rid of filling root partition.

some extra information can be found here on managing disk space for docker . http://www.scmtechblog.net/2016/06/clean-up-docker-images-from-local-to.html

-- vishal sahasrabuddhe
Source: StackOverflow