What is tempfs in docker volume and how to use it?

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.

This is useful to temporarily store sensitive files that you don’t want to persist in either the host or the container writable layer

# example to use tmpfs mount 

docker run -itd --name harshit5 --mount type=tmpfs,destination=/opt/harshit ubuntu