title: Using pkg-config with Haskell Stack's Docker integration
body: <p>I'm trying to build a Haskell Stack project whose <code>extra-deps</code> includes <code>opencv</code>, which in itself depends on <a href="https://docs.opencv.org/3.0-beta/doc/tutorials/introduction/linux_install/linux_install.html" rel="nofollow noreferrer">OpenCV 3.0</a> (presently only buildable from source).</p>
  
  <p>I'm following the <a href="https://docs.haskellstack.org/en/stable/docker_integration/" rel="nofollow noreferrer">Docker integration</a> guidelines, and using my own image which builds upon <code>fpco/stack-build:lts-9.20</code> and installs OpenCV 3.0 (<a href="https://gist.github.com/dukedave/3fa6104e09e9671674259a4d65e681c9" rel="nofollow noreferrer"><code>Dockerfile.stack.opencv</code></a>). </p>
  
  <p>If I build my image I can confirm that <code>opencv</code> is installed and visible to <code>pkg-config</code>:</p>
  
  <pre><code>$ docker build -t stack-opencv -f Dockerfile.stack.opencv .
  $ docker run stack-opencv pkg-config --modversion opencv
  3.3.1
  </code></pre>
  
  <p>However if I specify this image in my <code>stack.yml</code>:</p>
  
  <pre><code>docker:
    image: stack-opencv
  </code></pre>
  
  <p>Attempting to <code>stack build</code> yields:</p>
  
  <pre><code>Configuring opencv-0.0.2.0...
  setup: The pkg-config package 'opencv' version &gt;=3.0.0 is required but it
  could not be found.
  </code></pre>
  
  <hr>
  
  <p>I've run the build without the Docker integration, and it completes successfully.</p>