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)

  • multiple django requirements with docker
  • Dockerizing an app that uses mxnet package in R
  • curl_slist_free_all() causes segfault on GKE w/ Debian 8.7
  • Run docker in shell using PHP
  • How do I know mapped port of host from docker container?
  • How to docker exec -ti CONTAINER_NAME /bin/bash on deployed docker stack?
  • How do i bind Docker container to a specific external IP address, if i need to allocate many ports?
  • How to use bash with an Alpine based docker image?
  • Can I transport just the image changes/layers i'm concerned with?
  • ASP.NET 5 and Docker error: /bin/sh: [dnx,: command not found
  • Moving Phundament web app to production
  • MongoDB Docker Windows dev env. linux production env. possible solution?
  • 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
    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.