title: Use Dockerfile to only install needed extensions (php8.0-apache)?
body: <p>I encounter since weeks problems with getting needed extensions installed in a container based on php8.0-apache.
  So far I have managed to get a container to run based on php8.0-apache image. With basic settings, it works.
  But missing extensions I manually added on CLI by using docker-php-ext-install after it took me 2 months to find out that the regular apt-install would not work.
  An improved way to do this was by adding a script before the final command that does these installation and other actions.
  However when container is restarted, it attempts to do the stuff which was alerady done, and this could be avoided by placing these instructions in a docker file (which I fully avoided so far working only with compose-YAML).
  What I despite of many hours searching and reading don't understand is whether a docker file has always to be &quot;complete&quot; or could as well be used to just add the extensions which I need?
  So what I would like to do is to use the original dockerfile from the image and only on top of this use the following to install the needed extensions:</p>
  <pre><code>FROM php:8.0-apache
  
  RUN docker-php-ext-install mysqli pdo_mysql exif gd tidy zip
  </code></pre>
  <p>From my attempts it seems as this does not work at all, so my conclusion is that the dockerfile always needs the &quot;full original&quot; code which I may change/adjust in respective sections.
  Does anyone know whether this is correct? Or is there any other way to automatically install needed extensions beside the mentioned script by an &quot;additional dockerfile&quot;? Would that little enhancement of the mentioned extensions really require a &quot;full-fledged&quot; dockerfile?</p>