snowindy
snowindy

Reputation: 3251

How to create docker container with custom root volume size?

I have hit a limit of 10Gb for default root volume size. For this particular container I need a larger size.

So far I've seen quite dirty hacks to override default size.

Could somebody provide me and the community with a clear example of specifying bigger volume size upon container creation? Thanks!

Upvotes: 3

Views: 1641

Answers (1)

Sobrique
Sobrique

Reputation: 53508

I'm going to offer an alternative suggestion - don't. Stop and ask yourself why you need a larger root volume. I would suggest it's likely to be because you're doing something that can be done a better way.

I would suggest that instead - you use a storage container (if another 10G would be sufficient) or use a passthrough mount to a local disk.

The problem with big containers is they're somewhat at odds with what containerisation is trying to accomplish - compact, lightweight and self contained program instances.

So I would suggest instead:

docker create -v /path/to/storage:/container_mount --name storage_for_my_app /bin/true

(Or you can just -v /container_mount to keep the data within the container)

Then when you fire up your container:

docker run -d --volumes-from storage_for_my_app your_image

However it may be useful to note - as of Docker 1.9, the size limit is 100G instead: https://docs.docker.com/engine/reference/commandline/daemon/

Upvotes: 2

Related Questions