title: How to handle missing dependencies with composer & docker?
body: <p>I have an application that I want to install for local development on my laptop with Docker. The application requires libraries from composer.</p>
  <p>I would like to avoid installing PHP on my laptop and all necessary extensions just to be able to run composer.</p>
  <p>I also don't want to run composer during the build inside of my application container, because I need the vendor folder on my local computer using mount binding.</p>
  <p>It looked like the perfect solution to me to install composer though a docker container as explained <a href="https://hub.docker.com/_/composer" rel="nofollow noreferrer">here</a>:</p>
  <pre class="lang-sh prettyprint-override"><code>docker run --rm --interactive --tty \
    --volume $PWD:/app \
    composer install 
  </code></pre>
  <p>However, when doing so, how do you resolve any PHP dependency conflicts?</p>
  <p>For example</p>
  <pre class="lang-sh prettyprint-override"><code>docker run --rm --interactive --tty \
         --volume $PWD:/app \
         composer require phpoffice/phpspreadsheet
  </code></pre>
  <p>will fail with</p>
  <pre class="lang-none prettyprint-override"><code>Using version ^1.14 for phpoffice/phpspreadsheet
  ./composer.json has been updated
  Loading composer repositories with package information
  Updating dependencies (including require-dev)
  Your requirements could not be resolved to an installable set of packages.
  
    Problem 1
      - phpoffice/phpspreadsheet 1.14.1 requires ext-gd * -&gt; the requested PHP extension gd is missing from your system.
      - phpoffice/phpspreadsheet 1.14.0 requires ext-gd * -&gt; the requested PHP extension gd is missing from your system.
      - Installation request for phpoffice/phpspreadsheet ^1.14 -&gt; satisfiable by phpoffice/phpspreadsheet[1.14.0, 1.14.1].
  </code></pre>
  <p>How can I solve this kind of problems?</p>