Inspect image layers
See each layer, its command, and size; identify bloat
docker history --no-trunc img:tag
- tool
- docker46 commands
More docker commands
-
docker system prune -af --volumesRemove stopped containers, unused images, networks, volumes
-
docker pull src-reg/img:tag && docker tag src-reg/img:tag dst-reg/img:tag && docker push dst-reg/img:tagRe-tag and push to another registry
-
docker save img:tag | gzip > img.tar.gzExport an image for air-gapped transfer
-
docker build --build-arg VERSION=1.2.3 --build-arg ENV=prod -t img:tag .Pass build-time variables into Dockerfile ARG instructions
-
trivy image --exit-code 1 --severity HIGH,CRITICAL img:tagFail pipeline if HIGH or CRITICAL CVEs found