Shell scripting
Running Compose from any directory
A command installed on the shell path can start almost anywhere. Its working directory is whatever directory the caller happened to be in.
The missing file
When a wrapper runs docker compose from an unrelated directory, Compose may report that it cannot find a configuration file. Moving the wrapper into ~/.local/bin makes it discoverable as a command. The wrapper still needs a path to the service configuration.
Make the project explicit
For a single service, the wrapper can keep the full path to a Compose file and pass it to each invocation. Quoting the variable also lets the directory name contain a space.
compose_file="$HOME/ai/llama.cpp/compose.yaml"
docker compose -f "$compose_file" psTry it from somewhere else
I test a wrapper from the repository and from an unrelated directory. If both invocations find the same project, the location is explicit. This small test also catches mistakes in symbolic links before they become part of my everyday setup.