Execute a container from another one

I wish to use a nodejs container with npm-watch package installed to launch a npm script when a series of watched files change. Obviously the container use a hosted volume to check if they change in host environment.

Now if these files change, I wish to launch a phpunit container that test all of them, in this one files are hosted as the other one.

The fact is that in the package.json I can run a script but the script can run docker only in local.

Even if I wish to use docker compose I can’t understand I can launch phpunit container by npm.

for instance:

"watch": {
"test": {
  "patterns": ["src", "tests"],
  "extensions": "php"
 "scripts": {
  "test": "docker-compose run --rm phpunit",
  "watch": "npm-watch"

but when I change a file, it says me: “sh: no docker-compose command”

How Can I solve?

Source: StackOverflow