2

I'm migrating from Ubuntu to MacOS with my MacBook Pro (M2). I'm using ohmyzsh with the docker and docker-compose plugin. Docker has been installed with Docker Desktop setup.

All works fine except the autocompletion for the container names. If I type docker start and ⮕Tab it just shows me the files of my current directory, but not the list of available containers.

I'm expecting the autosuggestion to work here and show me a list of all containers which could be started. This worked fine within Ubuntu.

I'd rather not run docker virtually or have to shell in to an already running container to get this functionality.

Is there a trick which I could use so the macOS command line has more completion options with zsh and docker for Mac?

4
  • So, just to be clear, this is just a problem with OMZ and not Docker? In other words, does Docker work fine otherwise?
    – Allan
    Jun 30, 2023 at 13:34
  • As far as I could test it yes. For example, docker can start a container with docker start xyz.
    – Theiaz
    Jun 30, 2023 at 13:36
  • Sorry for the conflicting edits that Allan and I had. Hopefully this is clearer and works for everyone to start on an answer.
    – bmike
    Jun 30, 2023 at 13:44
  • OhMyZsh (I personally stay away from it) is just a collection of Zsh scripts. There’s nothing specific to macOS that is different from Ubuntu, Mint, or whatever. You’ll likely get a faster, if not better answer from the OMZ community. That said, I’d probably start with a clean re-install of the Docker plugin to ensure it’s configured correctly.
    – Allan
    Jun 30, 2023 at 13:44

1 Answer 1

0

Try adding these two lines in your .zshrc file:

zstyle ':completion:*:*:docker:*' option-stacking yes
zstyle ':completion:*:*:docker-*:*' option-stacking yes

Source: https://github.com/felixr/docker-zsh-completion#docker-zsh-completion

1
  • Thats only for option-stacking like -it, not for my usecase :(
    – Theiaz
    Jul 11, 2023 at 12:44

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .