title: Error making http request across linked Docker containers
body: <p>I'm building a web application with Angular.js 2, Elasticsearch, and Docker. </p>
  
  <p>I'm trying to access Elasticsearch via its REST API from my Angular app using the linked url "<a href="http://search:9200/_cat/health" rel="nofollow">http://search:9200/_cat/health</a>", but I'm getting a <code>GET http://search:9200/_cat/health net::ERR_NAME_NOT_RESOLVED</code> error.  </p>
  
  <p>The weird thing is that when I do <code>curl -XGET "http://search:9200/_cat/health"</code> from inside the web app's container everything is fine and I'm getting a correct response. </p>
  
  <p>Here is my respective <code>docker-compose.yml</code> file</p>
  
  <pre><code>version: '2'
  services:
    search:
      image: elasticsearch:latest
      command: elasticsearch -Des.network.host=0.0.0.0
      ports:
        - "9200:9200"
        - "9300:9300"
    web:
      build: .
      command: npm start
      volumes:
        - .:/visfx
      ports:
        - "3000:3000"
      links:
        - search
  </code></pre>
  
  <p>also here's the call to the elasticsearch service</p>
  
  <pre><code>@Injectable()
  export class ElasticsearchService {
      private _esUrl = 'http://search:9200';
  
      constructor(private http: Http) { }
  
      getHealthString() {
          let healthUrl = '/_cat/health';
  
          return this.http.get(this._esUrl + healthUrl)
              .map(res =&gt; &lt;string&gt;res.text())
              .do(data =&gt; console.log(data))
              .catch(this.handleError);
      }
      ...
  }
  </code></pre>