如何将 docker 卷名称传递给 docker compose.yml

如何将 docker 卷名称传递给 docker compose.yml

我知道需要的卷名

sudo docker volume ls
...
cfc151dc475be39535b438d54d245107c5f1ce022622a0eae53bc03016aa987d

我想将这个卷(但在命令行中更改)传递给 docker compose 文件。

nginx:
  image: "nginx:alpine"
  ports:
    - 6000:80
  links:
    - registry:registry
  volumes:
    - ./auth:/etc/nginx/conf.d
    - ./auth/nginx.conf:/etc/nginx/nginx.conf:ro
    - ./auth/domain.crt:/etc/ssl/certs/nginx-selfsigned.crt:ro
    - ./auth/domain.key:/etc/ssl/private/nginx-selfsigned.key:ro

registry:
  image: 5money:latest
    volumes:
    - registry-external-data:/var/lib/registry

volumes:
  registry-external-data:
    external: true
    ??name: $data??

我不明白最后一行,什么是正确的?我想开始编写类似这样的内容:

sudo docker-compose -f 5money-compose.yml up -d -e data=cfc151dc475be39535b438d54d245107c5f1ce022622a0eae53bc03016aa987d

相关内容