Xdebug with Docker on localhost with proxy to the Internet
Simple config to allow Xdebug to connect to the VS Code and container to the Internet via proxy.
Mac
VS Code
Docker
Image: WordPress
Docker config
~/.docker/config.json
{
"proxies": {
"default": {
"httpProxy": "http://proxy.example.com:3128",
"httpsProxy": "https://proxy.example.com:3129",
"noProxy": "*.test.example.com,.example.org,127.0.0.0/8"
}
}
}
restart the container after the edit.
Xdebug client host setting
change client_host to the IP of the machine running Vscode
/usr/local/etc/php/conf.d/xdebug.ini
zend_extension=xdebug.so
xdebug.mode=develop,debug,trace
xdebug.client_port=9003
xdebug.start_with_request=yes
xdebug.discover_client_host=false
xdebug.xdebug.start_upon_error=yes
xdebug.client_host=192.168.1.88 //update here
restart the container after the edit.