Host does not find docker ip. How to solve?

0

The host is a MAC OS with Docker installed and with a container with php and xdebug configured.

I try to start a debug session in IntelliJ but it is not working.

My hypothesis is that since the host does not find the Docker container, the IDE is also unable to find the container. Here is an example of how xdebug work.

When I try to ping my host this is what I find:

  • Container ip = > docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' 64ad351e115f // Show 172.17.0.2
  • Container Ping = >
  • Shows loss of 100%

    How do I expose the container?

        
    asked by anonymous 22.11.2017 / 22:40

    1 answer

    0

    Your machine will not be able to ping the container because it is in another network (isolated), what you can do is map the container ports with your local machine. I do not know how your debugging tool works, but if it needs an ip and a port, you would have to do so:

    docker run --name <nome-do-container> -p 80:80 -p 9000:9000 <imagem:tag>
    

    Then your software would access this container by your localhost like this:

    localhost:80 ou locahost:9000
    
        
    31.07.2018 / 04:06