Docker Config Reference (docker history)
We go over many examples of using the docker history command
docker history nginx:latest
This command retrieves the build history of the latest version of the Nginx image, presenting each layer in reverse chronological order. It includes details such as the layer identifier (truncated), size in bytes, creation timestamp, and the instruction that generated the layer, enabling users to comprehend the image's construction process, including base image and subsequent modifications.
docker history --human nginx
By incorporating the --human flag, this command displays the history of the Nginx image with sizes converted to human-readable formats, such as megabytes or gigabytes, facilitating easier evaluation of layer contributions to the total image size without manual conversion of byte values.
docker history --no-trunc ubuntu:20.04
The --no-trunc option ensures that layer identifiers and creation commands are shown in their full, untruncated form for the Ubuntu 20.04 image, which is particularly useful for auditing purposes or when examining lengthy build instructions that would otherwise be abbreviated.
docker history --quiet alpine
Utilizing the --quiet flag, this command outputs only the layer identifiers for the Alpine image, suppressing additional details, which is advantageous for scripting scenarios where solely the SHA256 hashes are required for verification or automation tasks.
docker history --format "{{.ID}} {{.Size}}" redis
This command employs a custom format to display solely the layer identifier and size for the Redis image, allowing precise data extraction tailored to specific analytical needs, such as assessing the storage footprint of individual layers.
docker history mysql:8.0 | grep CMD
The history of the MySQL 8.0 image is retrieved and piped to grep to isolate lines containing "CMD", thereby highlighting the default command or entrypoint layers, which aids in understanding the image's intended runtime execution.
docker history --human --no-trunc postgres
Combining --human for readable sizes and --no-trunc for full details, this command provides a comprehensive view of the PostgreSQL image's history, supporting in-depth analysis for developers requiring exact layer information without summarization.
docker history hello-world
This command examines the history of the minimal hello-world image, typically revealing a single-layer structure, which serves as an educational tool to illustrate the simplicity of lightweight Docker images and their build composition.
docker history --format "table {{.CreatedBy}}" node:14
Formatting the output as a table, this command lists only the creation instructions for each layer in the Node.js 14 image, facilitating a structured review of the build sequence, including dependency installations and configurations.
docker history golang:1.17-alpine
The history of the Golang 1.17 image based on Alpine is displayed, detailing layers associated with the Go toolchain installation, which is valuable for Go developers seeking to optimize or replicate build processes.
docker history --quiet --no-trunc python:3.9
With --quiet to show only identifiers and --no-trunc for full hashes, this command outputs complete SHA256 values for the Python 3.9 image layers, enabling precise comparisons or integration with external systems like version control.
docker history httpd:2.4
This command presents the build history of the Apache HTTPD 2.4 image, including layers for web server setup and modules, assisting administrators in tracing applied security patches or customizations.
docker history --human mongo:4.4
Human-readable size formatting is applied to the MongoDB 4.4 image history, aiding in the assessment of storage efficiency for database-related layers, which may include substantial data or binary components.
docker history jenkins/jenkins:lts
The history of the Jenkins LTS image is retrieved, outlining layers for continuous integration tool configurations, which supports DevOps professionals in extending or modifying the base image.
docker history --format "{{.CreatedAt}} {{.Comment}}" wordpress
A custom format is used to show creation timestamps and comments for the WordPress image layers, providing a timeline perspective useful for analyzing build evolution or identifying specific changes.
docker history rabbitmq:3-management
This command displays the history of the RabbitMQ 3 image with management interface, including layers for messaging protocols and plugins, clarifying the integration of components in the build.
docker history --no-trunc elasticsearch:7
Full, untruncated details are shown for the Elasticsearch 7 image, supporting detailed forensic examination, particularly for configurations involving Java Virtual Machine settings or indexing tools.
docker history grafana/grafana
The build history of the Grafana image is presented, highlighting layers for dashboard and visualization functionalities, which is beneficial for monitoring system setups.
docker history --human prometheus
With human-readable sizes, this command examines the Prometheus image history, facilitating evaluation of the monitoring and alerting components' storage requirements.
docker history nginx:alpine | tail -n 5
The history of the Alpine-based Nginx image is piped to tail to display the most recent five layers, allowing a focused review on the latest build additions or modifications.
docker history --format "json" busybox
Formatting as JSON, this command outputs the Busybox image history in a structured format suitable for programmatic processing or integration into automation workflows.
docker history registry:2
This retrieves the history of the Docker Registry 2 image, detailing layers for image storage and distribution, essential for managing private registries.
docker history --quiet traefik:v2.5
In quiet mode, this command lists only layer identifiers for the Traefik v2.5 image, providing a concise output for tasks requiring hash values without additional context.
docker history --human --format "{{.ID}} {{.CreatedBy}}" kibana:7
Combining human-readable elements with a custom format, this displays layer IDs and creation commands for the Kibana 7 image, aiding in build process transparency.
docker history php:7.4-apache | grep EXPOSE
The history of the PHP 7.4 with Apache image is filtered via grep for "EXPOSE" instructions, identifying exposed ports and assisting in network configuration reviews.
docker history --no-trunc tensorflow/tensorflow:2.6.0
Full details are provided for the TensorFlow 2.6.0 image, supporting machine learning practitioners in examining layers for library installations and dependencies.
docker history --format "table {{.Size}} {{.Comment}}" jupyter/datascience-notebook
A table format lists sizes and comments for the Jupyter Data Science Notebook image layers, enabling quick assessment of component contributions.
docker history sonatype/nexus3
This command shows the history of the Sonatype Nexus 3 image, including repository management layers, useful for artifact management deployments.
docker history --human --quiet vault:1.8
Human-readable and quiet modes are combined for the Vault 1.8 image, though --quiet typically overrides size details, this may yield adjusted output for specific use cases.
docker history bitnami/minio | head -n 10
The history of the Bitnami MinIO image is piped to head to show the first ten layers, focusing on initial build steps for object storage configurations.