How to compose docker-compose.yml so i can access deamon's container with PHP?

Hi. I’m new to docker and probably I don’t understand something about relation between containers.

Lets say I have docker-compose.yml version 3 with Nginx+PHP. How do I add image vitr/casperjs so I can call it from PHP like

exec('/what/is/the/path casperjs --version', $output);

? Is it something about the volume? Is it something about the dependents?

I struggled a lot but i just don’t get it. Casperjs works fine with

$ docker exec my_alias_for_casperjs casperjs --version

but i can’t access it with PHP. How do i?

UPDATED:

Is it okay to merge PHP, PhantoJS and Casper JS into single Dockerfile?

Yes, you can merge it all on the same image, and it’s probably the best route if you want to call it all from one container.

I wasn’t sure what casperjs is, so I did a quick google search. It looks like something you’d run on a seperate testing container, and have all the tests pointed at your nginx/php container. Not entirely sure.

1 Like