DELAPARRA
Index
Color
NL
Category: Docker

build

Explained by Updated

What is build?

build: Tells Compose to build an image from a Dockerfile instead of pulling one. Can point at a context and a specific Dockerfile. In Docker Compose, the build key tells Compose to build an image from a Dockerfile instead of downloading one. You can set the build context, the Dockerfile name and build arguments.

Definition source Coders Lingo, CC BY 4.0

Frequently asked questions about build

How is build used in practice?

This is typical for your own application, while services like MySQL and Redis use image to pull an official image. docker compose up --build rebuilds before starting, which you need after changing the Dockerfile or dependencies.

What should you keep in mind with build?

Keep the build context small. Compose sends the whole context folder to the builder, so add a .dockerignore that excludes node_modules, vendor, .git and log files. That makes builds faster and stops secrets in local files from ending up in an image. You can combine build and image to give the built image a name and tag.

What does an example of build look like?

services: web: build: context: . dockerfile: Dockerfile args: VERSION: "1.0"

At a glance

CategoryDocker
Explained by
Updated

More Docker terms

All terms starting with B

Skills

Download all skills (zip)

Manuals

Related services

Need any help?

Stuck on one of these in your own project? Tell me what you are working on and I will tell you how I would approach it.