How can I resize disk size of a Docker container?

Every Docker container will be configured with 10 GB disk space, which is the default configuration of devicemapper in CentOS. So how can I configure every container newly created with more than 10 GB disk space in default? (The host server is installed with CentOS 6 and Docker 1.7.1)

  • Join SwarmKit cluster with predefined token?
  • Running magellan on pyspark-notebook docker container
  • How to start a docker container when windows boots
  • pg_restore to postgres running in docker container
  • Running ipython notebook in a Docker Container
  • Understanding Docker best practices
  • Set machine name for docker-compose
  • stop and delete docker container if its running
  • Installing a specific version of docker-engine (v1.7+) on Ubuntu?
  • New NodeJS Error Thrown While Running mupx deploy
  • What's the right way to setup a development environment on OS X with Docker?
  • docker-compose: links option not working
  • 2 Solutions collect form web for “How can I resize disk size of a Docker container?”

    Yes you can. Use the dm.basesize attribute when starting the Docker daemon. For example:

    docker daemon --storage-opt dm.basesize=50G ...
    

    More info can be found in the official docs.

    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.

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.