I would like to run entire docker container in memory without mapping volumes to host's hard drive.
TMPFS described here helps to mount volumes as "memory volumes", but I'm looking a way how to start entire container mapped to memory.
--volume-driver
probably what I have to use, but I can't find a documented list of supported drivers (not overlay2
).
So, I've tried:
docker run -td --name my-container --volume-driver tmpfs container-image
docker run -td --name my-container --volume-driver memfs container-image
But in both cases, with docker inspect my-container
I observed that:
"GraphDriver": {
"Data": {
"LowerDir": "/var/lib/docker/overlay2/d1d112972c6b531976dd33e27edf213fc578856c3ee96b99c9afe53ad3f71a5e- ... /diff",
"MergedDir": "/var/lib/docker/overlay2/d1d112972c6b531976dd33e27edf213fc578856c3ee96b99c9afe53ad3f71a5e/merged",
"UpperDir": "/var/lib/docker/overlay2/d1d112972c6b531976dd33e27edf213fc578856c3ee96b99c9afe53ad3f71a5e/diff",
"WorkDir": "/var/lib/docker/overlay2/d1d112972c6b531976dd33e27edf213fc578856c3ee96b99c9afe53ad3f71a5e/work"
},
"Name": "overlay2"
}
docker stats
also points me that both cases are using default mapping strategy.