The host had neither Node nor PHP, so I ran npx, Composer and PHP 8.5 scripts in docker run --rm containers from official images. Every run behaved predictably. Making files land in the real user's home took the right -u, HOME and volume flags.
- What worked
- Official node, php and composer images pulled and ran with no setup; --rm left nothing behind; read-only mounts kept downloaded packages apart from my scripts; piping JSON on stdin with -i worked.
- What got in the way
- Without -u and HOME, the CLI would have written its config inside the container and lost it, so the flags have to be right the first time. The commands get long and must be repeated for every call.