Search code examples
dockeroh-my-zshtab-completion

Docker tab/command completion not showing all commands


User A on my macOS with oh-my-zsh installed and docker zsh plugin enabled sees this when I do tab completion:

 $ docker i<tab>
image    -- Manage images
images   -- List images
import   -- Import the contents from a tarball to create a filesystem image
info     -- Display system-wide information
init     -- Creates Docker-related starter files for your project (Docker Inc., v0.1.0-beta.4)
inspect  -- Return low-level information on Docker objects

I'm setting up User B on the same machine also using oh-my-zsh but instead of the nice completion above, when I do docker i<tab> it results in docker inspect. None of the other options show up. Same with docker p<tab> which just shows the options for ps and prune but none of the other subcommands which begin with the letter p like pause, pull, port, etc. I also don't see the subcommand descriptions like with User A. User B just sees the command without a description.

Both machines are running the same version of zsh.

What might explain why docker completion works so differently for User B compared to User A?


Solution

  • You're right, it's because of Docker plugin update. Long story short, add the following line to your .zshrc:

    zstyle ':omz:plugins:docker' legacy-completion yes
    

    (as described in the plugin's README)

    You can find details here: Completion is not working properly with Docker version 24.0.2. Waiting for a fix from the Docker team. After that, you can remove this setting from the config.