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)

  • Running ServiceBus in windows docker container
  • Running mysql in the foreground in centos
  • How do I map volume outside C:\Users to container on Windows?
  • Maven WAR Build for Tomcat: “Could not open ServletContext resource [/WEB-INF/applicationContext.xml]”
  • docker containers share unix abstract socket or dbus
  • Docker: Write Permission on directory, but user cannot write
  • Docker: Setting up a GUI in a Docker Container on a Raspberry Pi
  • Getting error while runnig neo4j-mazerunner project
  • Obtaining a docker image's parent images
  • how to export VM (VirtualBox) to tgz archive?
  • Traefik with self-signed certificate
  • How can I increase timeouts of AWS worker tier instances?
  • 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.