title: Docker container calls binary from another container
body: <p>I have two dockers containers, one with Apache (+ PHP) and another with PostgreSQL (+ PostGIS, a spatial extension for PostgreSQL database).</p>
  
  <p>PostGIS has a binary (shp2pgsql) to transform a shapefile data in SQL instructions. When I need to do this, I run the following command:</p>
  
  <pre><code>/usr/bin/shp2pgsql {...arguments...} filename.shp &gt; insql.sql
  </code></pre>
  
  <p>In a specific case, when the user uploads a shapefile (in apache+php container), I need to run shp2pgsql in PostgreSQL+PostGIS container.</p>
  
  <p>I have already tried:</p>
  
  <ul>
  <li><p>Expose docker daemon to Apache docker container and call the binary shp2pgsql using docker exec command, but with no success, because apache user (who calls docker exec) don't have permission for it.</p></li>
  <li><p>Share volume "/usr/bin/" from PostgreSQL container to Apache container, but with no success, because the binary (shp2pgsql) have dependencies with others libraries (in others folders).</p></li>
  </ul>
  
  <p>Is there a elegant (or not) and viable way to do this?
  Is there others alternatives for this problem?</p>
  
  <p>Any suggestions or ideas are more than welcome.</p>