Help us understand the problem. What is going on with this article?

Docker inspectでのWORKDIRやENTRYPOINT取得

More than 1 year has passed since last update.

docker inspect-fオプション指定すればOKだけど、毎回忘れて調べてるからコピペ用にメモ。

WORKDIR取得

docker inspect -f "{{ .Config.WorkingDir  }}" your-image

ENTRYPOINT取得

docker inspect -f "{{ .Config.Entrypoint  }}" your-image

EXPOSE取得

docker inspect -f '{{ range $k,$v := .Config.ExposedPorts }}{{ println $k}}{{end}}' your-image

Author取得

docker inspect -f "{{ .Author  }}" your-image

Labels取得

以下のようにDockerfileでLABELが指定された場合

FROM alpine:latest
LABEL multi.label1="value1" multi.label2="value2" other="value3"

{{ index .Config.Label ラベルのキー }}という書式で取得します。

docker inspect -f '{{ index .Config.Labels "multi.label1"  }}' your-image
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away