Home > Back-end >  How do I use the IP of a container as an ENV var of another container
How do I use the IP of a container as an ENV var of another container

Time:12-09

I am trying to set up a docker-compose file where I have 2 services. There is a RabbitMQ broker and a publisher/consumer. In the code of the publisher/consumer, I set the connection up using an IP from the os environment variables. However, I am not sure how I can get the IP of a different container, and set it in the ENV variable.

CodePudding user response:

Just use the compose service name instead of ip.

  • Related