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
本文介绍如何利用Docker的tmpfs挂载特性来提高容器应用的性能及安全性,尤其是在处理临时数据时,避免将数据写入宿主机或容器的可写层。通过示例展示如何设置一次性密码等非持久性数据的存储。
1313

被折叠的 条评论
为什么被折叠?



