docker build
The command that builds an image from a Dockerfile and a build context.
In more detail
It reads the Dockerfile, runs each instruction and stores the result as image layers. The --tag option names the image so it can be pushed and referenced later.
Examples
docker build --tag "ghcr.io/acme/checkout:$GITHUB_SHA" .docker build -t taskapi:0.1 .docker build -t healthcheck:dev .docker build -q -t m04l01-client .Related terms
- Dockerfile — A text file of instructions, such as FROM, COPY and RUN, that tells Docker how to build an image.
- docker push — The command that uploads a local image to a registry.
- tag — A human-readable label such as 3.20 or latest attached to an image in a repository, which can be moved to point at a different image.
- build context — The set of files you hand to docker build, usually the current directory given as the final dot.
- BuildKit — The build engine behind docker build, which runs steps in parallel, caches smartly and supports secrets and multiple platforms.
- build cache — Saved results of earlier build steps that a build tool, such as Docker, reuses when nothing a step depends on has changed.
- multi-stage build — A Dockerfile with several FROM stages, where later stages copy only what they need from earlier ones.
- image — A read-only package containing a program and everything it needs to run, used as the template for containers.
Taught in
- Building and Pushing Container Images — Continuous Integration & Continuous Delivery Pipelines
- Artifact Promotion: Staging to Production — Continuous Integration & Continuous Delivery Pipelines
- Container Images The Exam Way — Certified Kubernetes Application Developer (CKAD) Exam Prep
- Union Filesystems, Images And Writable Layers — Docker Architecture & Production Containers
- Docker, OCI, The Engine And The CLI — Docker Architecture & Production Containers
- Run The Spine Service And Publish Its Port — Docker Architecture & Production Containers
- Build Context, Dockerignore And Your First Dockerfile — Docker Architecture & Production Containers
- FROM, WORKDIR, COPY And ADD — Docker Architecture & Production Containers
- RUN, SHELL And Efficient Layer Caching — Docker Architecture & Production Containers
- ARG, ENV, LABEL, EXPOSE And VOLUME — Docker Architecture & Production Containers
- CMD, ENTRYPOINT, USER And Process Signals — Docker Architecture & Production Containers
- Multi Stage Builds, Targets And Build Secrets — Docker Architecture & Production Containers
- Tags, Digests And Reproducible Image References — Docker Architecture & Production Containers
- Authenticate, Tag, Push And Pull From A Registry — Docker Architecture & Production Containers
- Minimal Bases, Non Root Users And Smaller Images — Docker Architecture & Production Containers
- Scan, Patch And Inspect The Software Supply Chain — Docker Architecture & Production Containers
- Ephemeral Filesystems And Named Volumes — Docker Architecture & Production Containers
- Bind Mounts, Permissions And Backups — Docker Architecture & Production Containers
- Bridge Networks, DNS And Container Communication — Docker Architecture & Production Containers
- Port Publishing, Localhost And Network Troubleshooting — Docker Architecture & Production Containers
- Environment, Secret Files And Runtime Restrictions — Docker Architecture & Production Containers
- Diagnose Crashes, Resource Limits And Unhealthy Containers — Docker Architecture & Production Containers
- Build, Test And Promote The Same Image In CI — Docker Architecture & Production Containers
- Harden And Deliver The Complete Service Stack — Docker Architecture & Production Containers
- From Local Containers To Kubernetes — Docker Architecture & Production Containers
- Containerizing and Testing the Final Build — Concurrent Systems Programming with Go
- A Producer In Python — Apache Kafka & Event Streaming
- Duplicates Are The Default — Apache Kafka & Event Streaming