A Zsh plugin providing fzf-powered keyboard shortcuts for Docker Swarm and shell productivity.
The main feature is ctrl+w: a two-step fzf picker that finds and execs into containers across all nodes of a Swarm cluster — no SSH, no manual context switching.
Managing Docker Swarm clusters typically requires SSH-ing into multiple nodes to find where a specific container is running. lazy-cli automates this:
- Docker Contexts configured for your cluster
- Contexts named with a namespace pattern:
my-system.1,my-system.2, ...,my-system.N(one per Swarm node) - Switch to any context in the namespace —
ctrl+wsearches the rest automatically
Before lazy-cli:
ssh my-system-node-1.mycompany.com
docker ps | grep my-container # not here
ssh my-system-node-2.mycompany.com
docker ps | grep my-container # not here
ssh my-system-node-3.mycompany.com
docker ps | grep my-container # finally here!
docker exec -it <container_id> bashWith lazy-cli:
Press ctrl+w, pick the service, pick the container — done.
- Service picker — lists all Swarm services in the current context
- Container picker — finds matching containers across every node in the namespace; navigate with arrow keys, then:
| Key | Action |
|---|---|
e or Enter |
docker exec -it <container> bash |
i |
docker inspect <container> |
l |
docker logs -f <container> |
The command is placed in your prompt buffer so you can review or edit it before running.
Lists branches by most recent commit and checks out the one you pick. It opens
showing local branches; the scope cycles with ctrl-a:
| Scope | Shows |
|---|---|
local |
Local branches (the default) |
remote |
Remote branches you do not already have locally |
all |
Both, with a local / remote column |
The prompt always shows the current scope, e.g. branch (remote)>.
Remote branches already tracked by a local branch are hidden, so origin/main
never shadows main.
| Key | Action |
|---|---|
ctrl-a |
Cycle scope: local → remote → all |
ctrl-f |
git fetch --all --prune, then reload the list in place |
| Enter | Check out the selected branch |
The picker opens instantly from already-fetched refs — it never blocks on the
network. Press ctrl-f when you want the list refreshed.
Picking a local branch runs git checkout <branch>. Picking a remote-only
branch runs git switch --track <remote>/<branch>, creating a local branch that
tracks it.
| Shortcut | Description |
|---|---|
ctrl+h |
Toggle a cheatsheet of all shortcuts |
ctrl+x |
Pick a Docker context (session-local, colima first) |
ctrl+w |
Pick a Swarm service → container across nodes → exec / inspect / logs |
ctrl+e |
Pick a running container and exec into it (current context only) |
ctrl+l |
Pick a running container and tail its logs |
esc+L |
Pick a Docker Swarm service and tail its logs |
ctrl+b |
Git branch picker — local / remote / all, sorted by most recent commit |
ctrl+g |
Git log browser with diff preview |
ctrl+t |
Taskfile task picker |
ctrl+loverrides the default clear-screen binding. Useresetorclearinstead.
Two shell functions are available for scripting and bulk operations:
| Command | Description |
|---|---|
dlazy-foreach-svc <filter> <action> |
Run a docker service action against all services matching the filter |
docker-context-unset |
Unset the session-local DOCKER_CONTEXT override and fall back to the system-wide context |
dlazy-foreach-svc database rm
# Executes 'docker service rm' for each service with "database" in its nameAdd the following to your ~/.zshrc:
zinit light drozel/lazy-cliThen reload your shell:
source ~/.zshrc- Clone this repository into Oh-My-Zsh's plugins directory:
git clone https://github.com/drozel/lazy-cli.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/lazy-cli- Add
lazy-clito the plugins array in your~/.zshrc:
plugins=(... lazy-cli)- Reload your shell:
source ~/.zshrcgit clone https://github.com/drozel/lazy-cli.git ~/.lazy-cli
echo "source ~/.lazy-cli/dockerlazy.plugin.zsh" >> ~/.zshrc
source ~/.zshrc- Docker CLI with contexts configured (namespace pattern
cluster.1,cluster.2, … for multi-node features) - Zsh
- fzf
- Task — optional, for
ctrl+t
MIT