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)
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.
(optional) If you have already downloaded any image via
docker pullyou need to clean them first – otherwise they won’t be resized
docker rmi your_image_name
Edit the storage config
There should be something like
DOCKER_STORAGE_OPTIONS="...", change it to
DOCKER_STORAGE_OPTIONS="... --storage-opt dm.basesize=100G"
Restart the docker deamon
service docker restart
Pull the image
docker pull your_image_name
docker run -i -t your_image_name /bin/bash
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.