How can I debug php mounted to a container running on docker beta for mac How can I debug php mounted to a container running on docker beta for mac docker docker

How can I debug php mounted to a container running on docker beta for mac


UPDATE 2:

As pointed out by @Rashidul , Since 17.06 docker for Mac, you can replace xdebug.remote_host="192.168.65.1" with xdebug.remote_host="docker.for.mac.localhost"

UPDATE: The Correct way

so I eventually figured out that my xdebug settings in docker should be

xdebug.enable=1xdebug.remote_enable = 1xdebug.idekey="PHPSTORM"xdebug.remote_port=9000xdebug.remote_host="192.168.65.1"xdebug.remote_connect_back=0

where 192.168.65.1 is the entry found in ~/Library/Containers/com.docker.docker/Data/database/com.docker.driver.amd64-linux/slirp/host

In recent update the above no longer exists, to get the Docker host IP I know use the below my .profile

export DOCKER_HOST_IP=$(ipconfig getifaddr en0)

Also make sure to set the idekey correctly in the chrome extension, in my case PHPSTORM
With this I no longer require the ssh tunnel

Original Solution:

The workaround I used was to open up an ssh tunnel to the docker container running php using a command like, in my case I have the docker container ssh port mapped to 12 hence the -p 12

ssh -R 9000:localhost:9000 root@dtest.xxx.com -p:12