Executing php scripts from the CLI across containers


I’m having trouble executing a php script across the containers. I’ve tried approaches like this:

docker run -it php {php_file} [...args]


docker exec devilbox-php-1 php -f docker run -it php {php_file} [...args]

But in both cases I end up getting an error along the lines of “Could not open input file: {file_path}”

I’ve verified chmod. I’m not exactly sure what file path root I need to use. This is a WSL2 setup without Docker Desktop. I sincerely appreciate any advice out there. Thanks a lot!

@wilrevehl maybe you should provide container ID in docker exec:
docker exec abcd12345678 php /shared/httpd/project/file.php

You can find the container ID running docker ps from devilbox folder:


I’ll give that a try! Thanks for the idea.