Bastian
Bastian

Reputation: 5865

How to increase the size of a Docker volume?

I want to use a Docker container as a backup server (mainly as an openssh daemon). For that I need to attach a volume to it in order to store the data. In the docs I could only find how to attach the volume, not how to set its size. So I attach a volume with:

docker run -p=2222:22 -d -v /backup docker-ssh

and do a df -h inside the container and get this:

Filesystem                    Size  Used Avail Use% Mounted on
none                          101G   20G   76G  21% /
tmpfs                         7.9G     0  7.9G   0% /dev
shm                            64M     0   64M   0% /dev/shm
/dev/mapper/xubuntu--vg-root  101G   20G   76G  21% /backup

The first thing that strikes me is the exact same size and use of / and /backup. Is it a coincidence or are they the very same file?
But what I really want to know is how to increase the size of /backup because I need more space for this backup.

Upvotes: 2

Views: 5567

Answers (1)

Valdas
Valdas

Reputation: 1084

Docker volumes are just links to host volumes, so they are same size as host directory is.

If you mount a larger volume, more space will be available for the container.

/ and /backup are same size as they points to same storage device.

Upvotes: 1

Related Questions