What do docker image inspect and docker image history show, and how would you use them on an image?
inspect returns the image's full metadata as JSON (architecture, OS, layers, env, entrypoint, digest); history lists the instructions that built each layer, newest first.
docker image inspect alpine:latest prints a JSON document including Architecture (for example amd64), Os (linux), RepoTags, RepoDigests, the Config block (environment, Cmd, Entrypoint, exposed ports, labels) and the list of layer hashes under RootFS. Use --format with a Go template to pick out fields:
docker image inspect --format "{{.Os}}/{{.Architecture}}" alpine:latest # linux/amd64
docker image inspect --format "{{.RepoTags}} : {{.RepoDigests}}" alpine:latest
Many images are multi-architecture: Docker Hub holds variants for amd64, arm64 and others, and the engine pulls the one matching the host. On the lab's x86-64 machine that is linux/amd64.
docker image history apacheimage lists one row per build step, newest first. For an image built FROM alpine:latest, the top rows belong to your own Dockerfile (CMD, EXPOSE, the ENV lines, the RUN steps, LABEL) and the bottom rows to the base image (Alpine's ADD alpine-minirootfs-….tar.gz / and CMD ["/bin/sh"]). The cut between them is exactly the FROM line. Rows with a size of 0 B are metadata-only steps.
Both are first checks on an unfamiliar image: what will it run, as which user, and what did its author do to build it?
Go deeper:
Docker Docs: docker image inspect — options and
--formatexamples.Docker Docs: docker image history — reading an image's layer history.
Docker Docs: Multi-platform builds — how one tag can hold images for several architectures.