title: Install mongodb driver in docker with dockerfile
body: <p>I have a mongodb docker container. I need another docker container which will have php and apache installed. I want to run a php script from this container and send some data to the mongodb container to save the data in mongodb database. So i need to install mongodb driver in the php-apache container. </p>
  
  <p>To do that, i have created following dockerfile: </p>
  
  <pre><code>FROM php:7.3-apache
  COPY src/ /var/www/html
  RUN apt-get update
  RUN apt-get install openssl libssl-dev libcurl4-openssl-dev
  RUN pecl install mongodb
  RUN cp /usr/local/etc/php/php.ini-production /usr/local/etc/php/php.ini
  RUN echo "extension=mongodb.so" &gt; /usr/local/etc/php/php.ini
  EXPOSE 80
  </code></pre>
  
  <p>It first builds php-apache docker image. Then it should install mongodb driver.</p>
  
  <p>But when i run the following command</p>
  
  <pre><code>docker build -t my-mongo .
  </code></pre>
  
  <p>At one point it shows following message and stops the execution:</p>
  
  <pre><code>Need to get 2213 kB of archives.
  After this operation, 9593 kB of additional disk space will be used.
  Do you want to continue? [Y/n] Abort.
  The command '/bin/sh -c apt-get install openssl libssl-dev libcurl4-openssl-dev' returned a non-zero code: 1
  </code></pre>
  
  <p>What went wrong here? Is there anything wrong in the dockerfile ?</p>