
#DOCKER IP ADDRESSES FOR MAC#
I was confused by their instructions to use the host’s private IP because in other containers, like Vagrant and Docker via VirtualBox, you do have to set xdebug.remote_host to the IP that the container identifies the host with, which is typically the the gateway IP of the container, or the one seen in the access logs.Īnd so, my working Xdebug config on a Docker for Mac container is simply the following: xdebug.remote_enable=on However, I want two Docker containers to both be running on port 80 on the physical server, and be accessed by separate IP addresses from servers on the same network as. I tried creating dummy IP addresses on the Docker host.
#DOCKER IP ADDRESSES DOWNLOAD#
Workstations will use HTTP to download files. These containers must be identifiable by unique IP addresses with calls over port 80. These Docker containers will share one host that has one physical NIC. In fact, Docker has a brief Xdebug tutorial where they do this. If I only have one Docker container set up, I can expose port 80 on the Docker container and connect to the Docker container via the public IP address of the physical server. The Docker containers will run Apache or some web service. I connect to it through a container running jwilder/nginx-proxy that exposes port 80. You can set an alias IP on your host if you want, but it would appear that you can likewise use an IP already assigned to the host on the local network. I have an nginx container and a php-fpm container running together as my web server. It would appear that you can set xdebug.remote_host to any hostname/IP that your host computer is identified by, not the IP that the container uses to identify your host, which typically starts with 172. I, like pretty much everyone else here, could not get Xdebug to work with such a Docker for Mac container until I disabled xdebug.remote_connect_back. I’m not totally sure if this is what’s happening, but it’s my best guess. As a result, it thinks that the request is coming from the container rather than the host. The default subnet for a docker network is 172.17.0.0/16. With this command, Docker will set up the standard network model: It will create a veth interface pair.

This also means that each container in the docker network is assigned an IP address. Start your docker container, using the -p option to bind exposed ports to an ip address and port on the host: docker run -d -name web -p 10.12.0.117:80:80 larsks/simpleweb. One reason could be because when you enable xdebug.remote_connect it tries to connect to 127.0.0.1:9000, which is the IP of the request according to the container, probably due to how Docker for Mac integrates the networking of the host and container. Each network of containers has a subnet mask and can be used to distribute IP addresses to its containers.

When this is on, the xdebug.remote_host setting is ignored.įor whatever reason, Docker for Mac prevents Xdebug from allowing such unrestricted connections. So, normally, you could set xdebug.remote_connect_back=on in order for Xdebug to connect to any client that makes a request to the server regardless of hostname/IP. Alright, I’d like to add my two cents to this excellent thread.
