Speed Up CI Docker I/O Intensive Workloads with tmpfs


Volumes and bind mounts let you share files between the host machine and container so that you can persist data even after the container is stopped.

If you’re running Docker on Linux, you have a third option: tmpfs mounts. When you create a container with a tmpfs mount, the container can create files outside the container’s writable layer.

As opposed to volumes and bind mounts, a tmpfs mount is temporary, and only persisted in the host memory. When the container stops, the tmpfs mount is removed, and files written there won’t be persisted.

–via https://docs.docker.com/storage/tmpfs/

Docker supports tmpfs volume mounts. tmpfs mounts can be used for CI workloads that are disk I/O intensive to trade off additional memory for faster filesystem access by keeping the filesystem entirely within memory.

I’ve seen massive speed-ups in GitHub Actions test workflows at Venmo that were often accessing databases.