Docker: in a memory file system

I have a docker container that does a lot of read / write to disk. I would like to check what happens when my entire docker file system is in memory. I saw several answers here that say that this will not be a real performance improvement, but it is for testing.

The ideal solution that I would like to test is to share the common parts of each image and copy to memory space when necessary.

Each container file that is created at runtime must also be in memory and shared. it should be no more than 5 GB fs in idle mode and up to 7 GB during processing.

Simple solutions will duplicate all shared files (even those parts of the OS that you never use) for each container.

+5
source share
2 answers

There is no difference between image storage and the container’s underlying file system, the layered FS accesses the image layers directly as the RO level, and the container uses the RW layer above to catch any changes. Therefore, your goal is to have a container running in memory while the Docker installation remains on disk, has no easy implementation.

If you know where your RW activity is (it’s quite simple to check the docker diff working container), the best option for me would be tmpfs mounted in this place in your container, which is initially supported by docker (from the link for launching dockers ):

 $ docker run -d --tmpfs /run:rw,noexec,nosuid,size=65536k my_image 
+5
source

Docker by default saves image, container and volume data in its folder. Container HD files are made from the original image and the “container layer”.

You may be able to install this using a RAM disk . You would allocate some RAM, mount it and format it using your file system. Then move your dock to the installed RAM disk and bind it to the original location again.

Disk setup

The best way to move the Docker directory

Obviously, this is only useful for testing like Docker, and images, volumes, containers, etc. will be lost upon reboot.

+1
source

All Articles