title: Getting Docker linked containers localhost pointing to host localhost
body: <p>So on my host environment I have this tomcat service running on port 10000 so I can access the office internal services.</p>
  
  <p>I have a windows hosts entry:</p>
  
  <p><code>localhost developer.mycompany.com</code></p>
  
  <p>So I can access the endpoint <code>developer.mycompany.com:10000/some/url</code> and if successful return a json response.</p>
  
  <p>I also have a Docker compose file that has spun up nginx and php-fpm containers and linked them to run a linux based PHP development environment.</p>
  
  <p>What I am trying to achieve is to make the docker container(s) aware of the <code>developer.mycomoany.com</code> host entry. So when my PHP code on my linke containers sends a POST request to <code>http://developer.mycompany.com:10000/some/url</code>it knows about the host entry and is able to hit that end point.</p>
  
  <p>I have tried the config <code>net=host</code> but that doesn't work with linked containers.</p>
  
  <p>PHP app error message:</p>
  
  <blockquote>
    <p>{"result":{"success":false,"message":"Error creating resource: [message] fopen(): php_network_getaddresses: getaddrinfo failed: Name or service not known\n[file] /srv/http/vendor/guzzlehttp/guzzle/src/Handler/StreamHandler.php\n[line] 282\n[message] fopen(http://developer.mycompany.com:10000/app/register): failed to open stream: php_network_getaddresses: getaddrinfo failed: Name or service not known\n[file] /srv/http/vendor/guzzlehttp/guzzle/src/Handler/StreamHandler.php\n[line] 282"}}</p>
  </blockquote>
  
  <p>How do I enable my PHP app on my linked containers to talk to the host <code>developer.mycompany.com</code> (localhost) entry?</p>
  
  <p>Here is my docker-compose:</p>
  
  <pre><code>app:
    image: linxlad/docker-php-fpm
    tty: true
    ports:
     - "9000:9000"
    volumes:
     - ./logs/php-fpm:/var/log/php-fpm
     - ~/Development/Apps/php-hello-world:/srv/http
  web:
    image: linxlad/docker-nginx
    ports:
     - "8080:80"
    volumes:
     - ./conf/nginx:/etc/nginx/conf.d
     - ./logs/nginx:/var/log/nginx
     - ~/Development/Apps/php-hello-world:/srv/http
    links:
     - app
  </code></pre>
  
  <p><strong>Edits:</strong></p>
  
  <p>Her is my ifconfig output from docker machine.</p>
  
  <p><a href="https://i.stack.imgur.com/MNptF.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/MNptF.png" alt="enter image description here"></a></p>
  
  <p>Thanks</p>