Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to increase Docker container default size?

Tags:

docker

We have created docker image with default size of 10GB and we have loaded cassandra data now it is full means there is no space. Can anyone tell how to increase the docker container size to 40GB from 10GB without loss of existing data.

like image 1000
Pand005 Avatar asked Jun 23 '15 05:06

Pand005


1 Answers

I don't think it is possible (without the losing of the data). Here is how you enlarge the basesize:

  1. (optional) If you have already downloaded any image via docker pull you need to clean them first - otherwise they won't be resized

    docker rmi your_image_name

  2. Edit the storage config

    vi /etc/sysconfig/docker-storage

    There should be something like DOCKER_STORAGE_OPTIONS="...", change it to DOCKER_STORAGE_OPTIONS="... --storage-opt dm.basesize=100G"

  3. Restart the docker deamon

    service docker restart

  4. Pull the image

    docker pull your_image_name

  5. (optional) verification

    docker run -i -t your_image_name /bin/bash

    df -h

I was struggling with this a lot until I found out this link http://www.projectatomic.io/blog/2016/03/daemon_option_basedevicesize/ turns out you have to remove/pull image after enlarging the basesize.

like image 74
Ondrej Svejdar Avatar answered Sep 24 '22 23:09

Ondrej Svejdar