title: Docker for mac 1.12.0: how to connect to host from container
body: <p>I've updated docker on my os x 10.10, so it's now using os x native virtualization. However, I've found it tricky to connect to my host machine from within my nginx container. I tried this:</p>
  
  <p><code>/sbin/ip route|awk '/default/ { print $3 }'</code></p>
  
  <p>And got the answer: </p>
  
  <p><code>172.17.0.1</code></p>
  
  <p>Then I used this ip in docker-compose.yml:</p>
  
  <pre><code>  extra_hosts:
      - "master:172.17.0.1" 
  </code></pre>
  
  <p>But nonetheless I keep getting errors:</p>
  
  <p><code>172.17.0.1 - - [21/Jul/2016:09:33:46 +0000] "GET /api HTTP/1.1" 502 575      "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36" "-"
  2016/07/21 09:33:46 [error] 7#7: *1 connect() failed (111: Connection refused) while connecting to upstream, client: 172.17.0.1, server: soc-credit.ru, request: "GET /api HTTP/1.1", upstream: "http://172.17.0.5:8080/api", host: "localhost"</code></p>
  
  <p>Please note this part: <code>client: 172.17.0.1</code>. Since I've made request from host machine, it proves that ip I got in first step was correct. But connection wasn't established anyway. </p>
  
  <p>I want to stress out that I have a problem connecting FROM WITHIN container TO host and not vice versa.</p>
  
  <p>What am I doing wrong? Thank you!</p>