opencodeco / phpctl

🐳 It is a Docker (containers) based development environment for PHP 🐘
https://phpctl.dev
MIT License
287 stars 18 forks source link

No command is working #20

Closed castro732 closed 6 months ago

castro732 commented 8 months ago

Installed as per the readme instructions, that is runnning the following command:

wget -q https://phpctl.dev/phpctl-installer.sh && \ bash phpctl-installer.sh && rm phpctl-installer.sh

If I run for example phpctl php -m I get docker: Error response from daemon: failed to create task for container: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: exec: "sh": executable file not found in $PATH: unknown.

Every command returns the same.

System specs: image

flavioheleno commented 7 months ago

Not an exact reproduction, but a similar issue as well:

$ phpctl php -m
[FATAL tini (7)] exec sh failed: No such file or directory
$ phpctl doctor
PHP_VERSION=82
PHPCTL_DIR=/home/flavio/Documents/../
PHPCTL_IMAGE=opencodeco/phpctl:php82
PHPCTL_RUNTIME=docker
PHPCTL_TTY=-it
PHPCTL_USER=flavio
$ docker -v
Docker version 25.0.2, build 29cf629222
$ uname -a
Linux behemoth 6.7.4-arch1-1 #1 SMP PREEMPT_DYNAMIC Mon, 05 Feb 2024 22:07:49 +0000 x86_64 GNU/Linux
$ bash --version
GNU bash, version 5.2.26(1)-release (x86_64-pc-linux-gnu)
leocavalcante commented 7 months ago

Not sure how to reproduce this. This setup: https://github.com/opencodeco/phpctl/blob/main/tests/install/archlinux.Dockerfile Works fine: asciicast

flavioheleno commented 6 months ago

Apparently the issue lies in the fact that to run docker on my machine (might be the same case for @castro732), I must run it with sudo as my user does not belong to the docker group (for security reasons), and thus the environment variables break something in between.

The original command that phpctl executes:

docker run \
  --init \
  --platform linux/x86_64 \
  --rm \
  --label=no-tty \
  --name phpctl_12e00d0a742b \
  --user root \
  -eSHELL \
  -eCOLORTERM \
  -eSUDO_GID \
  -ePHP_VERSION \
  -eMAKE_TERMOUT \
  -eCOMPOSER_AUTH \
  -eSUDO_COMMAND \
  -eSUDO_USER \
  -ePWD \
  -eLOGNAME \
  -ePHPCTL_TTY \
  -eXAUTHORITY \
  -eHOME \
  -eLANG \
  -eLS_COLORS \
  -eXDG_CURRENT_DESKTOP \
  -eMFLAGS \
  -eMAKEFLAGS \
  -eTERM \
  -eUSER \
  -eMAKE_TERMERR \
  -eDISPLAY \
  -eSHLVL \
  -eMAKELEVEL \
  -eLC_CTYPE \
  -ePATH \
  -eSUDO_UID \
  -eMAIL \
  -eBASHUNIT_ROOT_DIR \
  -v /var/run/docker.sock:/var/run/docker.sock \
  -v /root/.gitconfig:/root/.gitconfig:ro \
  -v /home/flavio/Documents/open-source/phpctl:/usr/local/src \
  -w /usr/local/src \
  -v /home/flavio/Documents/open-source/phpctl/bin/..//php.ini:/etc/php81/conf.d/zphp.ini \
  -v /root/.config/composer:/root/.config/composer \
  --net host \
  --entrypoint sh -- opencodeco/phpctl:php81 -c pint --version

by removing all -e* arguments and adjusting volume sources, I've got it to work.

docker run \
  --init \
  --rm \
  --label=no-tty \
  --name phpctl_12e00d0a742b \
  --user root \
  -v /var/run/docker.sock:/var/run/docker.sock \
  -v /home/flavio/.gitconfig:/root/.gitconfig:ro \
  -v /home/flavio/Documents/open-source/phpctl:/usr/local/src \
  -w /usr/local/src \
  -v /home/flavio/Documents/open-source/phpctl/php.ini:/etc/php81/conf.d/zphp.ini \
  -v /home/flavio/.config/composer:/root/.config/composer \
  --net host \
  --entrypoint sh -- opencodeco/phpctl:php81 -c pint --version
leocavalcante commented 6 months ago

No OP activity.