-
Notifications
You must be signed in to change notification settings - Fork 140
Description
Expected Behavior
Assuming a Compose service app
using this Docker image and phpstan/phpstan
is installed via Composer, running its binary vendor/bin/phpstan
should work without the path prefix vendor/bin
:
± docker compose exec app phpstan
Note: Using configuration file /var/www/html/phpstan.neon.
453/453 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100%
[OK] No errors
Current Behavior
Trying to run a Composer binary without path fails:
± docker compose exec app phpstan
OCI runtime exec failed: exec failed: unable to start container process: exec: "phpstan": cannot run executable found relative to current directory: unknown
This seems to be related to Go 1.19 which dropped support for executing commands from the current directory (a "dot path") as a security measurement. Obviously the Docker engine did upgrade to this Go version in the meantime.
This Docker image adds (among others) vendor/bin
to the $PATH
which did allow for running Composer binaries so far but this has stopped working now:
Possible Solution
Use absolute paths in the $PATH
, so /var/www/html/vendor/bin
and /usr/src/app/vendor/bin
instead of just vendor/bin
depending on CLI/FPM/Apache variant.
Steps to Reproduce (for bugs)
- Have a recent Docker engine (23.0 or newer)
- Install a Composer package which provides a binary
- Use Docker Compose or Docker
exec
to run that binary just by its name - See the error mentioned above
Context
Developing PHP-based apps. ;-)
Your Environment
- Version used: 8.1-v4-fpm-node16
- Operating System and version: Debian Sid
- Link to your project: n/a