title: Cannot reach files found on host with Docker (Failed to open stream: Connection timed out)
body: <p>I have the following Docker container setup to power my CMS but I'm having some major issues with a PHP script hosted within the <code>extensions</code> volume.</p>
  
  <pre><code>version: '2'
  
  services:
      bolt:
          image: rossriley/docker-bolt:3.2
          network_mode: bridge
          environment:
              - BOLT_TITLE=Red Moon Workshop
          ports:
              - 80:80
          volumes:
              - ./db-data:/var/www/html/app/database
              - ./files:/var/www/html/public/files
              - ./app/config:/var/www/html/app/config
              - ./public/theme/redmoon:/var/www/html/public/theme/redmoon
              - ./extensions:/var/www/html/extensions
          restart: always
  </code></pre>
  
  <p>Inside my <code>extensions</code> volume I have a PHP script which reads the headers from files stored within the same host. The script is usually a bit more complex but I've boiled it down to one point of failure, this:</p>
  
  <pre><code>$image = 'http://beta.redmoonworkshop.us/files/2017-06/1497665310_slide-splash-bg.png';
  $headers = get_headers($image);
  
  return $headers;
  </code></pre>
  
  <p>The error complains about it not being able to open the stream due to a timeout, however if I open the URL within the browser it works just fine.</p>
  
  <pre><code>An exception has been thrown during the rendering of a template ("Warning: get_headers(http://beta.redmoonworkshop.us/files/2017-06/1497665310_slide-splash-bg.png): failed to open stream: Connection timed out")
  </code></pre>
  
  <p>I was able to get this working locally but once I pushed the application to Digital Ocean it's started to fail, so I'm not sure what's happening here. I have a PHP dependency for this script stored inside the Docker container and I have the script stored in a volume, however I've tried it both ways with both on the Docker container with no luck. </p>
  
  <p>If I try and reach any remotely hosted files it works without issue. (Anything from imgur or google etc)</p>
  
  <p>Could this be a permission issue, or some sort of breakdown in communication between Docker and the host? I'm fairly new to both PHP and Docker so any assistance would be greatly appreciated.</p>
  
  <hr>
  
  <p><strong>Update #1</strong></p>
  
  <p>I attempted to cURL the file from the host via the following command and it worked.</p>
  
  <pre><code>curl -i http://beta.redmoonworkshop.us/files/2017-06/1497665310_slide-splash-bg.png
  </code></pre>
  
  <p>I attempted to do the same <strong>within</strong> the Docker container and it failed with the following error:</p>
  
  <pre><code>Failed to connect to beta.redmoonworkshop.us port 80: Connection timed out
  </code></pre>
  
  <p>If I attempt to Curl the same image (but on localhost) it works. </p>
  
  <pre><code>curl -i http://localhost/files/2017-06/1497665310_slide-splash-bg.png
  </code></pre>