I'd like to create an in-memory filesystem within a docker container running on a cluster where I can't assign the container any special permissions (e.g. the container can't have CAP_SYS_ADMIN capability necessary for using mount).

Is it possible to create an in-memory filesystem under docker? Will one of the user space filesystems provide this functionality?

Reference article(s):

UPDATE: After finding and reading the references added above it's looking more and more like the answer is a firm no. I'll leave this open a bit in case anyone wants to elaborate or correct me.

2 Answers 2


Kubernetes can mount a ram disk for you. The answer is right there in the standard RTFM guide.


Create an emptyDir volume and set emptyDir.medium to "Memory" to build, what I interpret from the documentation to be, a dynamically sized memory file system which counts against the containers memory limit.

If you're not running under kubernetes, whatever system that deploys the docker container would need to create the ram disk and mount that into the container, or give the container the special permissions discussed in the various reference articles in the question.

  • Thank you for your answer, but please be considerate in your choice of words; "RTFM" and "right there" can be perceived as belittling and patronising, and everyone has different skill and comprehension levels :)
    – Jules
    Commented Sep 25, 2022 at 6:13
  • 1
    Ah, yes, but I was only belittling myself as it's an answer to my own question, and I'm probably a fair judge of when I deserved it, and I thought I deserved it just a little. :) I wouldn't be so harsh a critic of anyone else. Commented Sep 26, 2022 at 16:29
  • 2
    I didn't see that! Wow, serves me right for scrolling SO that late at night. Where's the self-love?!
    – Jules
    Commented Sep 27, 2022 at 14:06

This means that you can start a container where the /host directory is the / directory on your host; and the container can alter your host file system without any restriction. This is similar to how virtualization systems allow file system resource sharing.

Docker containers are very similar to LXC containers, and they have similar security features. When you start a container with docker run, behind the scenes Docker creates a set of namespaces and control groups for the container.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.