How do I increase the size of the default Docker container?

We created a docker image with a default size of 10GB and we downloaded the cassandra data, now it is full, so no space. Can anyone tell me how to increase the size of the docker container to 40GB from 10GB without losing existing data.

+3


source to share


2 answers


The default Docker container base using devicemapper has been changed from 10 GB to 100 GB. Below is a link to the relevant pull request on github .

Hotfix issue # 14678

The current default is 10G. Change it to 100G. The reason is that for some people 10G is too small, and we have no way to grow it dyamically.

This is simply overkill and no real space is allocated until the container actually writes data. And this is no different from fs graphics drivers where the virtual size of the container root is unlimited.

Signed: Vivek Goyal vgoyal@redhat.com



Using the latest version of docker should solve your problem.

+2


source


I don't think this is possible (no data loss). This is how you build up the basics:

  • (optional) If you have already uploaded any image with docker pull

    , you need to clear them first, otherwise they will not be modified.

    docker rmi your_image_name

  • Edit the storage configuration

    vi /etc/sysconfig/docker-storage

    It should be something like DOCKER_STORAGE_OPTIONS="..."

    , change it toDOCKER_STORAGE_OPTIONS="... --storage-opt dm.basesize=100G"

  • Restart docker deamon

    service docker restart

  • Pull the image

    docker pull your_image_name

  • (optional) check

    docker run -i -t your_image_name /bin/bash

    df -h



I struggled with this a lot until I found out this link http://www.projectatomic.io/blog/2016/03/daemon_option_basedevicesize/ it turns out you need to delete / pull the image after the base is enlarged.

0


source







All Articles