You have drupal 7 image from docker hub, and want to connect tomongo db via php code.
The Dockerfile for this is:
FROM drupal:7.57-apache
RUN apt-get update; \
apt-get install openssl libssl-dev libcurl4-openssl-dev -y; \
pecl install mongodb; \
echo "extension=mongodb.so" > /usr/local/etc/php/conf.d/mongodb.ini \Build the image
``` docker build -t drupal-with-mongo . ```Run Container
``` docker run --name drupal-with-mongo -p 8080:80 -d drupal-with-mongo ```Download Dockerfile
You can get the file from github at:https://github.com/GyanByte/drupal7-with-mongoYou can mount volume, if you want.
Enjoy!













