How to use environment variables in docker compose

0 votes

I'd like to be able to use env variables in docker-compose.yml, with values passed in when docker-compose is started. This is an illustration.

Today, I'm doing it with a standard Docker run command wrapped around my own script. Is there a way to do it without using bash wrappers and compose?

proxy:
  hostname: $hostname
  volumes:
    - /mnt/data/logs/$hostname:/logs
    - /mnt/data/$hostname:/data
Apr 30, 2022 in Docker by rajiv
• 1,620 points

edited Mar 4 49 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP