title: Run laravel migration onto a remote host from a docker container
body: <p>How to reliably run </p>
  
  <pre><code>php artisan migrate --env=staging
  </code></pre>
  
  <p>where .env.staging is setup with a remote hostname or ip in the DB_HOST field
  OR</p>
  
  <pre><code>php artisan migrate --database=staging_db
  </code></pre>
  
  <p>where database.php has a staging_db with DB_HOST pointing to remote hostname or ip</p>
  
  <p>Whenever I run it I receive this error:</p>
  
  <blockquote>
    <p>[PDOException]   SQLSTATE[08006] [7] could not connect to server: No
    such file or directory    Is the server running locally and accepting 
      connections on Unix domain socket
    "/var/run/postgresql/.s.PGSQL.5432"?</p>
  </blockquote>
  
  <p>Not sure whats causing it? most likely due to the container being on an internal network which doesnt recognize the remote hostname or IP. How do I solve this?</p>