Score:0

How to pass docker volume name to docker compose.yml

pr flag

I know needed volume name

sudo docker volume ls
...
cfc151dc475be39535b438d54d245107c5f1ce022622a0eae53bc03016aa987d

And I want to pass this volume (but changing in command line) to docker compose file.

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??

I don't understand last line, what is correct? I want start compose something like this:

sudo docker-compose -f 5money-compose.yml up -d -e data=cfc151dc475be39535b438d54d245107c5f1ce022622a0eae53bc03016aa987d
Artur Meinild avatar
vn flag
Why do you want your volume name to be a string of random characters? Why not choose a sensible name instead?
Alex avatar
pr flag
@ArturMeinild, this volume was created automatically, my first start composer has been without volume definition at all. Now I want reuse existing volume. And is string name (sensible or random) critical to correct build composer file? Name is only string litheral, but how to correct define it in compose file?
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.