Never used a docker.

How to install PHP 7 with mongodb driver and apache module, so that each in its own docker container was.

And the main thing is how to tie it into a bundle to make it work?

  • I would like to concretize the question. Specifically on the assembly, it is enough just to take a php image: 7-apache and install mongodb from pecl. - etki

1 answer 1

If you do not want to go deep into the docker and quickly start, I advise you to put https://docs.docker.com/compose/ right away. After that, you just need to use the following docker-compose.yml + Dockerfile (to install the pecl extension in php) at the root of your project:

docker-compose.yml

web: build: . dockerfile: Dockerfile links: ["mongo"] ports: - "80:80" volumes: - .:/var/www/html #создайте папку logs предварительно environment: - APACHE_LOG_DIR=./logs mongo: image: mongo ports: - "27017:27017" 

Dockerfile:

 FROM php:7.0.6-apache # копируем ваш кастомный виртуал хост, по желанию ADD /path/to/your/apache2.conf /etc/apache2/apache2.conf RUN apt-get update && apt-get install -y \ libssl-dev \ && a2enmod rewrite \ && pecl install mongodb \ && docker-php-ext-enable mongodb 

And then docker-compose up -d and that's it. If there are errors - write, I will answer in the comments