LoginSignup
5
4

More than 3 years have passed since last update.

Docker Desktop for Mac のタグ補完(Shell Completion)

Posted at

いちいち tag をコピペしたりがめんどくさかったり、オプションを覚えてられない。 Docker Desktop for Mac の場合に、毎回忘れてしまうのでメモを書いておく :pencil:

Install shell completion

Docker Desktop for Mac comes with scripts to enable completion for the docker, docker-machine, and docker-compose commands. The completion scripts may be found inside Docker.app, in the Contents/Resources/etc/ directory and can be installed both in Bash and Zsh.

$ ls /Applications/Docker.app/Contents/Resources/etc/
docker-compose.bash-completion  docker-compose.zsh-completion   docker-machine.bash-completion  docker-machine.zsh-completion   docker.bash-completion      docker.fish-completion      docker.zsh-completion

docker に関しては bashzsh 以外に fish もある。

$ ln -s /Applications/Docker.app/Contents/Resources/etc/docker.bash-completion $(brew --prefix)/etc/bash_completion.d/docker
$ ln -s /Applications/Docker.app/Contents/Resources/etc/docker-machine.bash-completion $(brew --prefix)/etc/bash_completion.d/docker-machine
$ ln -s /Applications/Docker.app/Contents/Resources/etc/docker-compose.bash-completion $(brew --prefix)/etc/bash_completion.d/docker-compose

コマンドやオプションももちろんイメージもタグ補完が聞くので便利 :bulb:

5
4
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
4