我正在尝试使用 docker secrets 来存储在 AWS Elastic Beanstalk 上使用的外部 api 密钥,尽管我似乎遗漏了什么?这是我当前的配置,屏幕截图和 api 密钥模糊:
docker-compose.yml 与秘密:
version: "3.8"
services:
backend:
image: "s_censored_p:latest"
environment:
bestbuy.api.url: /run/secrets/api_key
ports:
- "80:8080"
secrets:
- api_key
secrets:
api_key:
external: true
docker-compose.yml 没有秘密:
version: "3.8"
services:
backend:
image: "s_censored_p:latest"
environment:
bestbuy.api.url: "https://api.bestbuy.com/v1/products(sku in(6462266))?pageSize=100&cursorMark=*&format=csv&apiKey=qU_censored_CJ"
ports:
- "80:8080"
码头工人终端详细信息
➜ ~ docker secret ls
ID NAME DRIVER CREATED UPDATED
pp8vsbxqk9z85zmdlnaxrudsl api_key 2 hours ago 2 hours ago
➜ ~
➜ ~ docker service ls
ID NAME MODE REPLICAS IMAGE PORTS
gen8g85of3b2 api_key replicated 1/1 s_censored_p:latest
➜ ~
➜ ~ docker exec -it $(docker ps --filter name=api_key -q) cat /run/secrets/api_key
https://api.bestbuy.com/v1/products(sku in(6462266))?pageSize=100&cursorMark=*&format=csv&apiKey=qU_censored_CJ%
➜ ~
➜ ~