Build a container image¶
To run an upstream image with local changes, such as a baked-in config file or a patched package, build it on the host instead of pushing it through a registry.
The examples build myapp from nginx and run it as the container webapp.
Write a build spec¶
ImageTagmust start withlocalhost/<build name>:, herelocalhost/myapp:.containerfileholds the Containerfile's content, not a path.contextFilesare the files the Containerfile canCOPYorADD. To mount files into the running container instead, useconfigFiles(see Mount config files and dirs).
Reference the build from a container¶
Set the container's Image to <build name>.build:
Preview and apply¶
Deploy both specs in the same input; a container that references a missing build fails validation.
podman builds the image before it starts the container.
From then on, a change to containerfile or contextFiles rebuilds the image and restarts the container.
A newer base image behind the same FROM tag doesn't trigger a rebuild; syslet leaves image updates to other tools.
Related tasks¶
Remove a build¶
Drop the build spec and every Image that references it, then preview and apply.
Builds can't be locked, so the build unit and its context are always removed.
The built image is deleted too, unless the build sets reclaimPolicy: "Retain".