How containers/buildah works
Buildah is a CLI and Go API for constructing OCI or Docker-format images, primarily by creating a working container, applying build instructions or direct edits, then committing the result. The README documents this user workflow and additional image/container operations; sampled source shows CLI initialization, build-stage execution, file-copy support, and container mount handling. Several command implementations and integrations were not sampled, so documented capabilities are included but uncertain implementation links are omitted or marked unverified.
Main entry points: main.go Buildah CLI · run.go Run command · pull.go Pull image · build.go Build command
Components 20
Command interface
- Buildah CLI
cmd/buildah/main.go - Flag parsing
pkg/parse/parse.go - Build command
cmd/buildah/build.go
Image construction
- Build API
define/build.go - Build stages
imagebuildah/stage_executor.go - File transfer
copier/copier.go - Confidential workloads
internal/mkcw/archive.go
Working containers
- Create container
cmd/buildah/from.go - Add and copy
cmd/buildah/addcopy.go - Run command
cmd/buildah/run.go - Isolated execution
chroot/run_linux.go - Volume mounts
internal/volumes/volumes.go - Image configuration
cmd/buildah/config.go
Image operations
- Commit container
cmd/buildah/commit.go - Pull image
cmd/buildah/pull.go - Push image
cmd/buildah/push.go - Image and container management
cmd/buildah/images.go
Other components
- Buildah user
- Local image storage
- Image registry
Connections 22
- Buildah user → Buildah CLI: invokes
- Buildah CLI → Flag parsing: uses parsing
cmd/buildah/main.go - Buildah CLI → Build command: dispatches commands
- Build command → Build API: configures build
- Build API → Build stages: builds stages
- Build stages → File transfer: copies files
imagebuildah/stage_executor.go - Buildah user → Create container: creates working container
- Buildah user → Add and copy: adds content
- Buildah user → Run command: runs instruction
- Run command → Isolated execution: executes isolated
- Run command → Volume mounts: applies mounts
- Buildah user → Image configuration: sets image config
- Buildah user → Commit container: commits container
- Buildah user → Pull image: requests image
- Pull image → Image registry: pulls from
- Pull image → Local image storage: stores image
- Buildah user → Push image: publishes image
- Push image → Image registry: pushes to
- Buildah user → Image and container management: manages local objects
- Commit container → Local image storage: writes image
- Image and container management → Local image storage: manages stored images
- Buildah user → Confidential workloads: creates confidential workload