【发布时间】:2018-10-01 23:47:52
【问题描述】:
我想知道如何将外部机密传递到由 docker-compose 生成的服务中。我执行以下操作:
我创建了新的秘密
printf "some secret value goes here" | docker secret create wallet_password -
我的 docker-compose.yml:
version: "3.4"
services:
test:
image: alpine
command: 'cat /run/secrets/wallet_password'
secrets:
- wallet_password
secrets:
wallet_password:
external: true
然后我运行:
docker-compose -f services/debug/docker-compose.yml up -d --build
和
docker-compose -f services/debug/docker-compose.yml up
我收到以下回复:
WARNING: Service "test" uses secret "wallet_password" which is external. External secrets are not available to containers created by docker-compose.
WARNING: The Docker Engine you're using is running in swarm mode.
Compose does not use swarm mode to deploy services to multiple nodes in a swarm. All containers will be scheduled on the current node.
To deploy your application across the swarm, use `docker stack deploy`.
Starting debug_test_1 ...
Starting debug_test_1 ... done
Attaching to debug_test_1
test_1 | cat: can't open '/run/secrets/wallet_password': No such file or directory
Sooo.... 有没有办法将外部机密传递到由 docker-compose 生成的容器中?
【问题讨论】:
标签: docker docker-compose