title: Docker Compose use both host and bridge network
body: <p>I have 2 images that I want to talk to each other via compose's default bridge network, but I also want them to be able to access my host network. </p>
  
  <p>To allow images to talk to each other within compose's default bridge network, I don't need to do anything:</p>
  
  <pre><code>version: '3.4'
  services: 
    hello:
     image: hello-world
  
    world:
      image: hello-world
  </code></pre>
  
  <p>With the above spec, <code>hello</code> service could reference <code>world</code> service by using the DNS name <code>world</code></p>
  
  <p>If I wanted hello service to be able to interact with my host machine's network, I could add <code>network_mode: host</code> to the spec.</p>
  
  <pre><code>version: '3.4'
  services: 
    hello:
     image: hello-world
     network_mode: host
    world:
      image: hello-world
  </code></pre>
  
  <p>This allows <code>hello</code> service to access my host machine's network, but can no longer access <code>world</code> via compose's built in DNS. How can I accomplish both?</p>
  
  <p>I've tried creating a custom network, but custom networks can't use the host driver and I cannot use <code>network_mode</code> in combination with <code>networks</code>:</p>
  
  <p>This doesn't work:</p>
  
  <pre><code>version: '3.4'
  services: 
    hello:
     image: hello-world
     network_mode: host
     networks:
     - bridge
    world:
      image: hello-world
      networks:
      - bridge
  
  networks:
    test:
      driver: bridge
  </code></pre>
  
  <pre><code>$ docker-compose up
  ERROR: 'network_mode' and 'networks' cannot be combined
  </code></pre>