Bobcares

Xdebug on Docker doesn’t work on M1 Macbook Pro | How to fix

by | Dec 28, 2021

Xdebug on Docker doesn’t work on M1 Macbook Pro? Our experts have a solution for this issue. 

At Bobcares, we offer solutions for every query, big and small, as a part of our Server Management Service.

Let’s take a look at how our Support Team recently helped out a customer when the Xdebug on Docker doesn’t work on M1 Macbook Pro.

What to do if Xdebug on Docker doesn’t work on M1 Macbook Pro

If you have been having trouble with Xdebug on Docker on M1 Macbook Pro, you are in the right place. Our Support Engineers have been helping out our customers with this specific error recently. This error often shows up as seen below:

[71] Log opened at 2021-12-19 07:57:31
[71] I: Connecting to configured address/port: host.docker.internal:9005.
[71] W: Creating socket for 'host.docker.internal:9000', getaddrinfo: Invalid argument.
[71] E: Could not connect to client. :-(
[71] Log closed at 2020-12-29 07:57:36

According to the Docker official documentation, this error is referred to as known issue: sweat as seen below:

The DNS name host.docker.internal only works if you add --add-host=host.docker.internal:host-gateway to the docker run command

In other words, we cannot use the DNS name host.docker.internal without adding –add-host = host.docker.internal: host-gateway to docker run.

If we attempt this with docker-compose

extra_hosts: 
	- "host.docker.internal:host-gateway"

Xdebug on Docker doesn't work on M1 Macbook Pro

We will find the following description in the /etc/hosts file in the container:

192.168.65.1 host.docker.internal

However, sometimes this may cause a timeout connection message as seen below:

E: Time-out connecting to client (Waited: 200 ms). :-(

This indicates that the container to host (Mac) communication is broken.

After a couple of brainstorming sessions, our Support Techs took care of the issue by setting host-gateway to the IP.

For instance,

extra_hosts: 
	- "host.docker.internal:192.168.xxx.xxx"

If you are not sure about your IP address, you can access it with the following command:

ipconfig getifaddr en0
Once we set the host-gateway to the IP we will be able to resolve this error. We can get Xdebug on Docker to start working on M1 Macbook Pro with this easy hack.

 

[Seeking a solution to another query? We have your back.]

Conclusion

To sum up, the skilled Support Engineers at Bobcares demonstrated what to do when Xdebug on Docker doesn’t work.

PREVENT YOUR SERVER FROM CRASHING!

Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.

GET STARTED

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

Never again lose customers to poor
server speed! Let us help you.