A dead-simple, quality-of-life CLI booster for quick Docker (Compose) container access.
Save time by running commands in containers dynamically resolved from your local directory configuration.
- Context-Aware — Remembers configuration per-directory via a local
.dexfile. - Docker Compose Mode — Resolves container IDs dynamically from a service name (e.g.
app) and compose file, avoiding stale IDs. - Direct Container Mode — Executes directly against a fixed container name if Docker Compose isn't used.
- Compose Shortcuts — Built-in support for
--up,--down, and--restartdirectly inside your target project. - Interactive Shells — Running
dexwithout commands automatically spins up an interactive shell inside the container (defaults tosh, configurable in.dex).
dex -a, --assign [container_name] Assign a single container name
dex -a, --assign [compose_file] [service_name] Assign a service in a docker-compose file
dex -c, --clear Clear the local dex assignment
dex --up [params] Run docker compose up (compose mode only)
dex --down [params] Run docker compose down (compose mode only)
dex --restart [params] Restart the assigned container/service
dex [COMMANDS] Run commands inside the assigned container
dex Start an interactive shell in the assigned container
To assign a Docker Compose service in the current directory:
dex -a docker-compose.dev.yml appTo assign a single running container by it's name:
dex -a cool-container-7Execute any command inside the container:
dex php artisan migrateRun dex with no arguments to open an interactive terminal:
dexManage your Compose stack from the assigned directory:
dex --up -d
dex --down --remove-orphans
dex --restartRemove the local directory configuration:
dex -c
# or
dex --clearThe configuration is saved in the current directory inside a .dex file:
MODE="compose"
COMPOSE_FILE="docker-compose.dev.yml"
SERVICE_NAME="app"
SHELL="sh"MODE="container"
CONTAINER_NAME="cool-container-7"
SHELL="sh"curl -fsSL https://artifacts.grolmes.com/dex/install.sh | shClone the repository and copy the script to your local bin directory:
git clone https://github.com/madLinux7/dex.git
cd dex
chmod +x dex
cp dex ~/.local/bin/dex