Post

Docker Volume and Storage Notes

Docker Volume and Storage Notes

Docker Volumes

Docker volumes are used as persistent storage for containers to allow data to be stored even if those containers are stopped or deleted. This type of storage is separate from bind mounts and tmpfs mounts.

Bind mounts are another form of persistent storage for docker containers. They depend on the host machine’s file system and OS, while volumes are “completely managed by Docker” (Sharma, 2024). Meanwhile, tmpfs mounts are non-persistent, only stored in the host’s memory, and used for temporary storage.

I found the following image below to be helpful for visualizing these 3 types of storage for Docker containers:

Docker Image Diagram (Abbas, 2024).

Pantry Analogy for Docker Volumes

Another helpful way to think of Docker volumes is by imagining them as a pantry. Docker volumes exist outside of containers in a similar way to how pantries are separate from kitchens. Plus, the ingredients in pantries can be used for different recipes, and they still remain even if the kitchen is not in use. Similarly, volumes are persistent storage that can be used by multiple different containers (Bakare, 2024).

References

Docker Docs

This post is licensed under CC BY 4.0 by the author.