Adachinですっ。
今回は備忘録ですが、コンテナのIPとかMACアドレスとか
わざわざコンテナにアタッチして確認するのは、
とても理想的ではないので、dockerホストから確認する方法をブログします。
このイラストかわいい?
・3・b
■inspect
| 1 2 3 4 5 6 7 8 | Usage: docker inspect [OPTIONS] CONTAINER|IMAGE [CONTAINER|IMAGE...] Return low-level information on a container or image  -f, --format=""         Format the output using the given go template  --help                  Print usage  --type=container|image  Return JSON for specified type, permissible                          values are "image" or "container"  -s, --size              Display total file sizes if the type is container | 
ヘルプはこんな感じですが、よくわからんので例を出しますね。
■IP アドレス確認
| 1 2 | $ docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' 42946ed51f6e 172.17.0.2 | 
■MACアドレス確認
| 1 2 | $ docker inspect --format='{{range .NetworkSettings.Networks}}{{.MacAddress}}{{end}}' 42946ed51f6e 02:42:ac:11:00:02 | 
■コンテナログパス確認
| 1 2 | $ docker inspect --format='{{.LogPath}}' 42946ed51f6e /mnt/sda1/var/lib/docker/containers/42946ed51f6e097747f007d0bfe48c5da143d9ab9419136af8181499a926392d/42946ed51f6e097747f007d0bfe48c5da143d9ab9419136af8181499a926392d-json.log | 
■まとめ
ちなみにコレでも情報出ます。
| 1 | $ docker inspect 42946ed51f6e | 
ログとかJSONなんですな。
今更気づいた….
これで管理も楽になると思うので
みなさんもinspect使いこなしましょう!!
参考:https://docs.docker.com/engine/reference/commandline/inspect/
 
													 
													 
													
0件のコメント