Docker Community Forums

Share and learn in the Docker community.

Run command in container from OS

Hello, sorry if this is wrong category but I am new here.

What I want:
Run script hello.php using php in container phpcontainer, if container doesn’t run, then run it, if it runs, then execute command, and don’t stop container after executing command.

This is my command so far:
docker run -v $(pwd):/app -w /app phpcontainer php hello.php

What is the most effective / fastest way of doing it? Container and host OS runs on Debian 9.

Thank you