Docker 构建时的秘密

Docker secrets in build-time

是否有可能在构建期间在 Dockerfile 中使用 https://docs.docker.com/engine/swarm/secrets/(不是 docker-编写特定的 .yml 文件)?

Note: Docker secrets are only available to swarm services, not to standalone containers. To use this feature, consider adapting your container to run as a service with a scale of 1.

答案是否定的。秘密仅在 docker 群中可用。 Swarm 不构建图像,也不接受 Dockerfile。