Skip to content

Instantly share code, notes, and snippets.

@bradleybeddoes
Last active May 11, 2023 11:56
Show Gist options
  • Save bradleybeddoes/bd082f6e09cbcc3c9f0fda3e944b60f0 to your computer and use it in GitHub Desktop.
Save bradleybeddoes/bd082f6e09cbcc3c9f0fda3e944b60f0 to your computer and use it in GitHub Desktop.
Docker completion for Zsh + prezto
$ docker run<tab>
-- no matches found --
$ curl -fLo ~/.zprezto/modules/completion/external/src/_docker https://raw.githubusercontent.com/docker/docker/master/contrib/completion/zsh/_docker
$ docker run<tab>
-- images --
0a89c74fff6c -- latest in bradleybeddoes/docker-whale
-- repositories --
bradleybeddoes/docker-whale
$ docker run bradleybeddoes/docker-whale:<tab>
$ docker run bradleybeddoes/docker-whale:latest
_______________________________________
/ Everyone is a genius. It's just that \
| some people are too stupid to realize |
\ it. /
---------------------------------------
\
\
\
## .
## ## ## ==
## ## ## ## ===
/""""""""""""""""___/ ===
~~~ {~~ ~~~~ ~~~ ~~~~ ~~ ~ / ===- ~~~
\______ o __/
\ \ __/
\____\______/
@zx1986
Copy link

zx1986 commented Nov 21, 2017

It didn't work :-(

@0x3333
Copy link

0x3333 commented Dec 11, 2017

curl -fLo ~/.zprezto/modules/completion/external/src/_docker https://raw.githubusercontent.com/docker/cli/master/contrib/completion/zsh/_docker
compinit

@tizot
Copy link

tizot commented Feb 1, 2018

Thank you !! The link provided by @0x3333 works perfectly.

@jef
Copy link

jef commented Oct 18, 2018

thanks @0x3333

@pratio
Copy link

pratio commented Oct 8, 2019

@0x3333 Thank you for this, It works perfectly

@mitsh
Copy link

mitsh commented Apr 18, 2020

thanks @0x3333

@leppaott
Copy link

docker completion zsh > ~/.zprezto/modules/completion/external/src/_docker
rm -f ~/.zcompdump
rm -rf ~/.cache/prezto/*
compinit

@0x3333
Copy link

0x3333 commented May 10, 2023

docker completion zsh > ~/.zprezto/modules/completion/external/src/_docker

I believe that this works only for podman, am I wrong?

@leppaott
Copy link

docker completion zsh > ~/.zprezto/modules/completion/external/src/_docker

I believe that this works only for podman, am I wrong?

No? Latest docker desktop. docker/docs#16397

@0x3333
Copy link

0x3333 commented May 11, 2023

docker completion zsh > ~/.zprezto/modules/completion/external/src/_docker

I believe that this works only for podman, am I wrong?

No? Latest docker desktop. docker/docs#16397

Nice, for Docker 23 onwards. My mac was still on 20, afterupgrading it is working!

@0x3333
Copy link

0x3333 commented May 11, 2023

docker completion zsh > ~/.zprezto/modules/completion/external/src/_docker

I believe that this works only for podman, am I wrong?

No? Latest docker desktop. docker/docs#16397

Nice, for Docker 23 onwards. My mac was still on 20, after upgrading it is working, but it doesn't complete the container names, like the old one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment