LoginSignup
22
21

More than 5 years have passed since last update.

dockerのコマンド補完

Last updated at Posted at 2016-06-26

Dockerで試行錯誤しているとき、コンテナを作ったり潰したりします。

コンテナを潰すにはdocker killコマンドにコンテナIDかコンテナ名を渡すわけですが、ここの補完が効いてくれたらいいのにと思って探してみました。

Docker公式リポジトリから頂いてくる

docker/contrib/completion/

GitHubのDocker公式リポジトリの上記パスに、各種シェル用の補完設定ファイルが入っています。
私の環境(zsh+Prezto)の場合は、zsh用の_dockerファイルを~/.zprezto/modules/completion/external/srcに置きました。

補完が効いている状態でdocker killを叩いてTABを押すと

image

こんな感じに補完候補が出てきます。 便利。

22
21
0

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
22
21