title: How to connect to Docker bridge network from host?
body: <p>For a test project, I want to have the following network connectivity</p>
  <pre><code>                           +---------------------------+
                             | redis-service-1 in docker |
                             +-----------+ B +-----------+
                                         | R |
  +--------+                             | I |
  |  Host  |    ---&gt;                     | D |
  +--------+                             | G |
                                         | E |
                             +-----------+   +-----------+
                             | redis-service-2 in docker |
                             +---------------------------+
  
  </code></pre>
  <p>What I want to achieve is for my app running on <code>Host</code> it should be able to connect to both of the Redis services running in two docker containers using the DNS routing given by docker.</p>
  <p><code>docker-compose.yml</code> looks like the following:</p>
  <pre><code>version: '3.6'
  services:
    redis-service-1:
      image: redis:5.0
      networks:
        - overlay
    redis-service-2:
      image: redis:5.0
      networks:
        - overlay
  </code></pre>
  <p>Ideally after <code>docker-compose up</code> on the host I want to be able to ping both of the containers as following:</p>
  <pre><code>&gt; redis-cli -h redis-service-1 ping
  
  &gt; redis-cli -h redis-service-2 ping
  </code></pre>
  <p>But I am unable to connect to these containers and Redis inside them from the host machine.</p>