docker inpsect の結果を絞る方法

docker inspect をそのまま探すと、探したい情報にたどり着くまでに時間がかかる。

そんなときの対策。

 

docker inspect | find /I "key"

これだと該当行だけしか取得できず、NG。

 

docker inspect --help

Usage: docker inspect [OPTIONS] NAME|ID [NAME|ID...]

Return low-level information on Docker objects

Options:
-f, --format string Format the output using the given Go template
-s, --size Display total file sizes if the type is container
--type string Return JSON for specified type

 -f を使うと良いみたい。

 

でも"Format the output using the given Go template"の意味が分からずググる

blog.shibayu36.org

Golangのtemplateというものを使うということが分かりました。

こんなところでGolangとかかわることになるとは思わなかった。