dockerfile-image-tags
List or query images and tags used in a Dockerfile.
Usage
List all images and tags
Pass path to Dockerfile:
dockerfile-image-tags path/to/Dockerfile
Or pass Dockerfile as input:
cat path/to/Dockerfile | dockerfile-image-tags
Sample output (JSON):
[{"name":"golang","tag":"1.17.0-alpine"},{"name":"common","tag":"?"},{"name":"common","tag":"?"},{"name":"common","tag":"?"},{"name":"viaductoss/ksops","tag":"v3.0.0"},{"name":"quay.io/argoproj/argocd","tag":"$ARGOCD_VERSION"}]
Find single image tag
Pass -q (--query) to return tag for first occurrence of image with specified name:
dockerfile-image-tags -q golang path/to/Dockerfile
Pass -n (--occurrence) to return specified occurrence instead of first occurrence. For example, to return tag for second FROM golang
:
dockerfile-image-tags -q golang -n 2 path/to/Dockerfile
Sample output:
1.17.0-alpine