Use tmpfs mounts
Volumes and bind mounts are mounted into the container’s filesystem by default, and their contents are stored on the host machine.
There may be cases where you do not want to store a container’s data on the host machine, but you also don’t want to write the data into the container’s writable layer, for performance or security reasons, or if the data relates to non-persistent application state. An example might be a temporary one-time password that the container’s application creates and uses as-needed.
用法:
root@ubuntu:~# docker run -d --name tmptest --mount type=tmpfs,destination=/app,tmpfs-size=100M nginx