Steps to reproduce the issue:
Describe the results you received:
list of the files in the current directory
Describe the results you expected:
docker commands such as run
Additional information you deem important (e.g. issue happens only occasionally):
Output of docker version:
Client:
Version: 17.03.1-ce
API version: 1.27
Go version: go1.7.5
Git commit: c6d412e
Built: Tue Mar 28 00:40:02 2017
OS/Arch: darwin/amd64
Server:
Version: 17.03.1-ce
API version: 1.27 (minimum version 1.12)
Go version: go1.7.5
Git commit: c6d412e
Built: Fri Mar 24 00:00:50 2017
OS/Arch: linux/amd64
Experimental: true
Output of docker info:
Containers: 2
Running: 0
Paused: 0
Stopped: 2
Images: 2
Server Version: 17.03.1-ce
Storage Driver: overlay2
Backing Filesystem: extfs
Supports d_type: true
Native Overlay Diff: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
Volume: local
Network: bridge host ipvlan macvlan null overlay
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 4ab9917febca54791c5f071a9d1f404867857fcc
runc version: 54296cf40ad8143b62dbcaa1d90e520a2136ddfe
init version: 949e6fa
Security Options:
seccomp
Profile: default
Kernel Version: 4.9.27-moby
Operating System: Alpine Linux v3.5
OSType: linux
Architecture: x86_64
CPUs: 4
Total Memory: 1.952 GiB
Name: moby
ID: G4R3:BP7S:FOLV:44UL:RWQ7:Z4FP:PPAC:VGD5:GDJR:LQPP:VTEC:B2QR
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): true
File Descriptors: 16
Goroutines: 26
System Time: 2017-06-28T18:09:21.525357926Z
EventsListeners: 1
No Proxy: *.local, 169.254/16
Registry: https://index.docker.io/v1/
Experimental: true
Insecure Registries:
127.0.0.0/8
Live Restore Enabled: false
Additional environment details (AWS, VirtualBox, physical, etc.):
host os:osx sierra 10.12.16 beta
docker commands such as run
This sounds like the correct behaviour. Why do you expect a list of files?
this is what happens when I hit tab after docker. Does it seem correct? @dnephin
Sorry, I misread the issue. Yes this looks wrong. I believe this is the default tab completion when nothing is installed. So maybe the problem is that it didn't get installed correctly?
hi
this is the line of plugins
plugins=(git,docker)
And this is what I read on the internet to prevent username on the prompt
prompt_context(){}
I don't know if it has something to do with this.
And these are the plugins containing the word docker

I just tested the zsh completion and I hate to say that but _it works as expected on my machine_.

I'm using zprezto so I don't have the exact same setting but it should be really similar. From your screenshot I was wondering if the file shouldn't be _docker like it is in source.
You may also be interested in looking at that README especially if you are already using the zsh-completion package.
Hope that helps.
i have added zsh completion package as described in the doc and then sourced zshrc but it doesnt fix the issue and i couldnt understand what you meant by ' I was wondering if the file shouldn't be _docker like it is in source'
Sorry I misread the content of your screenshot. I assume that your tree looks like that ~/.oh-my-zsh/plugins/docker/_docker.
I think the array in your ~/.zshrc should be plugins=(git docker) (space separated) instead of plugins=(git,docker)
@jphuynh yep that was the issue 馃 thank you so much when i replace commas with spaces it worked like a charm .
I am running a Digital Ocean VPS with Ubuntu 16.04.4 LTS installed and the oh-my-zsh setup.
Autocompletion works for docker commands but not for images. This is when I am logging in as a user without admin rights (sudo is always needed when doing anything with docker ).
Logging in as root however, autocomplete for images does work.
Does someone have a clue how I get autocompletion for images for the user to work?
You don't have to be root to run Docker and arguably shouldn't.
Make sure your user is part of the Docker group or add it using: usermod -aG docker <yourUsername>
@jphuynh ... like charm, thank you! I had to logout/ login. The autocomplete for the images also works now!
uninstall/remove oh-my-zsh and install it again.
not working for me, take a look https://asciinema.org/a/gh0dsAd7wv14VyEIXi4OBJpke
I solved the issue removing docker-ce and installing docker & docker.io from ubuntu repository
and also put these two lines at the end of my .zshrc
autoload -Uz compinit
compinit
thanks @naoliv
The solution from @leite worked for me as well. Can anyone explain why this works? Why it's necessary that I add this and why it isn't in the core already?
Same issue @leite's suggestion fixed it for me as well.
Although @leite's solution worked for me too, manually removing the shell's completion database via
rm -v ~/.zcompdump*
forces the shell to rebuild it and the completion for Docker finally starts working, without adding
autoload -Uz compinit && compinit
to my .zshrc file.
Same issue. Tried @leite, @brainplot and @gitlines suggestions.
Not sure which suggestion actually made the fix.

rm ~/.zcompdump*
Work for me.
rm ~/.zcompdump* and reopening terminal still working on Linux Mint 17.04 too
rm ~/.zcompdump* worked on ubuntu 18.04 thanks !
Works on Mac OS (Mojave)! Thanks
rm ~/.zcompdump* and reopening terminal worked for me too (macOS Catalina 10.15.1). No need to do compinit as mentioned above - which also works btw.
Thank you. rm ~/.zcompdump* worked for me as well.
Although @leite's solution worked for me too, manually removing the shell's completion database via
rm -v ~/.zcompdump*forces the shell to rebuild it and the completion for Docker finally starts working, without adding
autoload -Uz compinit && compinitto my
.zshrcfile.
Thank you. this also worked for me.
If you've tried all of the above, and it zsh-completion for docker still doesn't work for you, that may be because you're in my situation:
~/.oh-my-zshell/plugins/docker/_docker is not loadedfpath variable explicitly per the mentioned stackoverflow answer: plugins=(git)
# Docker completions don't follow the standard, and path needs to be added directly to zsh-completions
# Also, "rm ~/.zcompdump*", and "source ~/.zshrc"
# https://stackoverflow.com/questions/37428133/zsh-docker-plugin-not-working
fpath+=($ZSH/plugins/docker)
plugins=(zsh-completions)
autoload -U compinit && compinit
TL;DR
https://github.com/zsh-users/zsh-completions/blob/master/zsh-completions-howto.org
Thank you @leite . It also solved my problem.
Thank you @axenol85 . Leite's solution good but had to do it every time when I open a new terminal.
Yours look like permanent solution. I followed steps from below link which you provided already.

Most helpful comment
Although @leite's solution worked for me too, manually removing the shell's completion database via
forces the shell to rebuild it and the completion for Docker finally starts working, without adding
to my
.zshrcfile.