LoginSignup
1
1

More than 5 years have passed since last update.

特定のプロセスの所属するdockerコンテナIDを調べる

Posted at
$ docker ps | tail  -n +2 | awk '{print $1}' | xargs docker inspect -f '{{ .State.Pid }} {{ .Config.Hostname }}`

これでPIDとDockerコンテナ(.Config.Hostname == コンテナ名でいいのか?) の一覧が出るので、
気になったPIDでgrepをかければコンテナIDがわかる。

ちなみに、tailtail -n +<N>N 行目以降をプリントするらしい。初めて知った。

1
1
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
1
1