title: Docker compose port forwarding not working properly
body: <p>When I use docker with the very simple command:</p>
  
  <pre><code>docker run -p 80:80 nginx
  </code></pre>
  
  <p>Port forwarding works properly and I can get nginx 'welcome page' when I go to localhost:80 using browser/curl.</p>
  
  <p>At the same time when I use very similar but docker-compose specific config:</p>
  
  <pre><code>version: '3'
  services:
    nginx:
      image: nginx
      ports:
       - "80:80"
  </code></pre>
  
  <p>And when I do <code>docker-compose up</code> and go to the browser - I see infinite loading, so looks like port forwarding is not configured properly, but I can't understand what is wrong in the config. 
  I tried using different browsers and curl, I'm getting the same result - infinite loading.</p>
  
  <p>Nginx here is just an example because of it's simplicity, in fact I have the same issue with redis/mysql/java images, so the issue isn't related to nginx.</p>
  
  <p>I've also tried the following ways to start container via docker-compose:</p>
  
  <pre><code>docker-compose run -p 80:80 nginx
  
  docker-compose run --service-ports nginx
  </code></pre>
  
  <p>but no luck, I've got the same result.</p>
  
  <p>In both cases (<code>docker run</code> and <code>docker-compose up</code>) I have the same network driver type - <code>bridge</code>. </p>
  
  <p>I've compared results of <code>docker inspect &lt;container id&gt;</code> for both cases: <a href="http://i.prntscr.com/obvxi0yESEa92znLDEu_PA.png" rel="noreferrer">http://i.prntscr.com/obvxi0yESEa92znLDEu_PA.png</a></p>
  
  <p>And results of <code>docker inspect &lt;network id&gt;</code>:
  <a href="http://i.prntscr.com/yyTpetvJSXa-dz4o9Pcl3w.png" rel="noreferrer">http://i.prntscr.com/yyTpetvJSXa-dz4o9Pcl3w.png</a></p>
  
  <p><code>ifconfig docker0</code> results:</p>
  
  <pre><code>docker0   Link encap:Ethernet  HWaddr 02:42:f1:9a:b6:72  
            inet addr:172.17.0.1  Bcast:0.0.0.0  Mask:255.255.0.0
            inet6 addr: fe80::42:f1ff:fe9a:b672/64 Scope:Link
            UP BROADCAST MULTICAST  MTU:1500  Metric:1
            RX packets:174 errors:0 dropped:0 overruns:0 frame:0
            TX packets:837 errors:0 dropped:0 overruns:0 carrier:0
            collisions:0 txqueuelen:0 
            RX bytes:47434 (47.4 KB)  TX bytes:107712 (107.7 KB)
  </code></pre>
  
  <p><code>brctl show</code> results:</p>
  
  <pre><code>bridge name     bridge id               STP enabled     interfaces
  br-f7adc3956101         8000.02427f870e7f       no
  docker0         8000.0242f19ab672       no
  </code></pre>
  
  <p><code>ifconfig</code> on the host machine results: <a href="https://pastebin.com/6ufWeYTE" rel="noreferrer">https://pastebin.com/6ufWeYTE</a></p>
  
  <p><code>route</code> on the host machine results: </p>
  
  <pre><code>Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
  default         gateway         0.0.0.0         UG    600    0        0 wlp4s0
  link-local      0.0.0.0         255.255.0.0     U     1000   0        0 docker0
  172.17.0.0      0.0.0.0         255.255.0.0     U     0      0        0 docker0
  192.168.0.0     0.0.0.0         255.255.255.0   U     600    0        0 wlp4s0
  </code></pre>
  
  <p>Both <code>docker</code> and <code>docker-compose</code> were installed using official sites instructions for Linux.</p>
  
  <p>Host OS: Ubuntu 17.04</p>
  
  <p><strong>UPDATE:</strong>
  I've tried to set 'attachable' network property in compose config and the issue was fixed. Though still unclear why is that happening.</p>
  
  <pre><code>networks:
    default:
    attachable: true
  </code></pre>