One of my steps in Dockerfile
requires more than 10G space on disk. It really does. However, all the intermediate containers in docker build
are created with 10G volumes.
What I did:
dockerd
with --storage-opt dm.basesize=25G
(docker info
says: Base Device Size: 26.84 GB
)It's no good: df -h
in an intermediate container still shows a 10G
disk, and docker inspect
of it shows "DeviceSize": "10737418240"
.
What have I missed? How do I increase the base volume size?
Adding a Volume To a Running Docker Container Containers must have their volumes configured on startup, which means to add a new volume, you must restart the container. While there is a hacky solution (more on that below), it's highly recommended that a container restart should be done anyway.
You can modify shm size by passing the optional parameter --shm-size to docker run command. The default is 64MB.
By default, volumes are 20GB and can be changed with --storage-opt "size=50GB" . Note that this method works for docker build.
To grant containers access to more space, we need to take care of two things:
--storage-opt dm.basesize=25G
Example:
--storage-opt dm.basesize=25G
docker run -it --rm ubuntu:xenial df -h
docker rmi ubuntu:xenial
docker pull ubuntu:xenial
docker run -it --rm ubuntu:xenial df -h
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With