Docker RAM 中存储的文件机密?

Docker File Secrets stored in RAM?

我有一个 PHP 应用程序,它从名为 "database.php" 的文件中读取数据库配置。现在,在生产服务器中,我打算将此 database.php 作为秘密文件 .

传递

我的问题是我的 PHP 应用程序是否会将秘密文件 (database.php) 作为普通文件读取(因为它不在文件存储中,而是在 RAM 中),或者如果读取由于容器必须向 SWARM 管理器请求秘密,因此会更慢。

docker 文档中有一个类似的例子,他们已将 index.html 作为秘密文件传递。 -> link to docs

My question is whether my PHP application will read the secret file(database.php) as a normal file(because it is not in file storage, but in RAM)

是的,对于 PHP 应用程序,这将显示为普通文件,不需要任何额外处理。

or if the read will be slower as the container has to request the secret from SWARM Manager.

读取不会变慢,因为秘密将被挂载(并因此复制到内存中),并且这只会完成一次。