jessarcher / zsh-artisan

Laravel artisan plugin for zsh to help you to run artisan from anywhere in the project tree, with auto-completion, and it can automatically open files created by artisan!
MIT License
622 stars 39 forks source link

The plugin cannot guess docker container name #21

Open phaberest opened 1 year ago

phaberest commented 1 year ago

I'm trying to call artisan and hitting tab inside a project that uses app as docker container name for the laravel instance, but I'm getting the error

service "php" is not running container #1

If I manually call the docker-compose exec it works

❯ docker-compose exec app php artisan
Laravel Framework 9.46.0

Usage:
  command [options] [arguments]
...

And the weird thing is that if I call the same command you are using inside the plugin to get the container name I get app as container name

❯ docker-compose ps --services 2>/dev/null | grep 'app\|php\|api\|workspace\|laravel\.test\|webhost'

app

After investigating a bit, looks like docker_compose_service_name is empty when executed from the plugin


OS: MacOS 13.1 (22C65) on a Macbook M1 2021 Shell: zsh 5.8.1 (x86_64-apple-darwin22.0) with Oh My Zsh Docker: Docker version 20.10.21, build baeda1f

phaberest commented 1 year ago

Turns out it works if I force _docker_compose_cmd function to always return docker-compose even though I have docker compose

❯ docker compose version
Docker Compose version v2.13.0
owrasor commented 1 year ago

I have the same problem.

phaberest commented 1 year ago

I ended up hardcoding docker-compose at least it works for now. Will try to give it another look, but as of now I just needed it to work

owrasor commented 1 year ago

I ended up hardcoding docker-compose at least it works for now. Will try to give it another look, but as of now I just needed it to work

I did the same.