0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

Docker の実験(その11:イメージの調査)

Last updated at Posted at 2023-02-19

その10:コンテナのレイヤのつづき。

イメージの調査方法

$ docker image inspect <image name>

イメージ内で特定の事項を調べたい場合はどうしたらよいだろうか。
単純に grep する。

$ docker image inspect nginx | grep 'Hostname'
            "Hostname": "412e505a8437",
            "Hostname": "",

format オプションを利用する。

$ docker image inspect nginx --format='{{.Id}}'
sha256:3f8a00f137a0d2c8a2163a09901e28e2471999fde4efc2f9570b91f1c30acf94
$ docker image inspect nginx --format='{{.ContainerConfig}}'
{412e505a8437   false false false map[80/tcp:{}] false false false [PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin NGINX_VERSION=1.23.3 NJS_VERSION=0.7.9 PKG_RELEASE=1~bullseye] [/bin/sh -c #(nop)  CMD ["nginx" "-g" "daemon off;"]] <nil> false sha256:81125abfc1520356faf20748ab85157762879efb86ee42f5061fb58c7b5bbae3 map[]  [/docker-entrypoint.sh] false  [] map[maintainer:NGINX Docker Maintainers <docker-maint@nginx.com>] SIGQUIT <nil> []}

json 形式での表示。

$ docker image inspect nginx --format='{{json .ContainerConfig}}'
{"Hostname":"412e505a8437","Domainname":"","User":"","AttachStdin":false,"AttachStdout":false,"AttachStderr":false,"ExposedPorts":{"80/tcp":{}},"Tty":false,"OpenStdin":false,"StdinOnce":false,"Env":["PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin","NGINX_VERSION=1.23.3","NJS_VERSION=0.7.9","PKG_RELEASE=1~bullseye"],"Cmd":["/bin/sh","-c","#(nop) ","CMD [\"nginx\" \"-g\" \"daemon off;\"]"],"Image":"sha256:81125abfc1520356faf20748ab85157762879efb86ee42f5061fb58c7b5bbae3","Volumes":null,"WorkingDir":"","Entrypoint":["/docker-entrypoint.sh"],"OnBuild":null,"Labels":{"maintainer":"NGINX Docker Maintainers <docker-maint@nginx.com>"},"StopSignal":"SIGQUIT"}

特定の項目の表示。

$ docker image inspect nginx --format='{{.ContainerConfig.Hostname}}'
412e505a8437

その12:イメージのクリーンアップ・検索につづく。

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?