9/10/2016 - 8:42 PM

Docker For Mac - De-facto Host Address Alias ( - "The 10254 Trick".

Docker For Mac - De-facto Host Address Alias ( - "The 10254 Trick".

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "">
<plist version="1.0">

Docker (Mac) De-facto Standard Host Address Alias

This launchd script will ensure that your Docker environment on your Mac will have as an alias on your loopback device ( The command being run is ifconfig lo0 alias


Copy/Paste the following in terminal with sudo (must be root as the target directory is owned by root)...

sudo curl -o /Library/LaunchDaemons/info.kevingustavson.docker_10254_alias.plist

Or copy the above Plist file to /Library/LaunchDaemons/info.kevingustavson.docker_10254_alias.plist

Next and every successive reboot will ensure your lo0 will have the proper ip address.


Because docker.local is gone. This seems to be the easiest way to setup xdebug to connect back to your IDE running on your host. Similarly, this is a solution for any kind of situations where a container needs to connect back to the host container at a known ip address.

For example, a configuration for xdebug in your php container for xdebug.ini might look like:

Also, your nginx and docker-compose would include an environment variable much like PHP_IDE_CONFIG="serverName=localhost"