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:
zend_extension=xdebug.so
xdebug.remote_host=10.254.254.254
xdebug.remote_enable=1
xdebug.remote_autostart=1
Also, your nginx and docker-compose would include an environment variable much like PHP_IDE_CONFIG="serverName=localhost"
Execute “ifconfig | grep 10.254.254.254”.
If empty, go to Solution 1.
If this is not the problem, verify ports are properly configured. Go to Solution 2.
This launch script will ensure that your Docker environment on your Mac will have 10.254.254.254 as an alias on your loop back device (127.0.0.1). The command being run is ifconfig lo0 alias 10.254.254.254
Installation
Copy/Paste the following in terminal with sudo (must be root as the target directory is owned by root)...
sudo curl -o /Library/LaunchDaemons/com.ralphschindler.docker_10254_alias.plist https://gist.githubusercontent.com/ralphschindler/535dc5916ccbd06f53c1b0ee5a868c93/raw/com.ralphschindler.docker_10254_alias.plist
Next and every successive reboot will ensure your lo0 will have the proper ip address.
Execute: “defaults read /Library/LaunchDaemons/com.ralphschindler.docker_10254_alias.plist”
You need to reboot your computer and execute again the ifconfig
.vscode/launch.json
{
"version": "0.2.0",
"configurations": [
{
"name": "Listen for Xdebug",
"type": "php",
"request": "launch",
"port": 9003,
"pathMappings": {
"/application": "${workspaceFolder}"
},
"log": true,
"xdebugSettings": {
"max_data": 65535,
"max_children": 100,
"max_depth": 5
}
}
]
}
docker-compose.yml
environment:
- PHP_IDE_CONFIG=serverName=app.xandrusoft.docker
- PHP_MEMORY_LIMIT=512M
- XDEBUG_MODE=debug
- XDEBUG_CONFIG=client_host=host.docker.internal client_port=9003 start_with_request=yes