Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amenophis1er/4cdfe6b33835709d9eb86c9786e3cfc9 to your computer and use it in GitHub Desktop.
Save amenophis1er/4cdfe6b33835709d9eb86c9786e3cfc9 to your computer and use it in GitHub Desktop.

Assuming that in your docker-compose.yml, you have 2 services and named them php and db:

<?php
# Assuming you name your differents services like `php`, `db` for example, you can get the IP address with
echo \gethostbyname('php');
echo \gethostbyname('db');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment