Docker Community Forums

Share and learn in the Docker community.

Different containers for httpd and php

We are very new to docker and have a question we’re hoping to get some assistance on so please bare with us.

I’m on a mac with El Capitan running Docker 1.31.1 and docker-compose 1.11.1.

We’ve created 2 images based on the amazonlinux images, one with php5.6 and one with httpd2.4.

We were hoping to have 2 containers, one for each and make it easier for our devs to try new versions of php when needed. Is it possible to have the httpd container use the php from the other container? I used a docker-compose.yml to set them up and both containers run fine. I can ping the php container from within the httpd container but it doesn’t see the php install in that container.

I would appreciate any help that anyone is willing to give.

you could map the php-binary and all libraries into your httpd container.
but this is quite flaky.
I would go for one container containing httpd and php. The php process anyway will run within the httpd-container.

Thank you for your time.

I took your advice and went the one container route and just built a second image with different php version.

Thanks again.