- How Buildah enables Dockerfile builds on OpenShift
- The structure of a Docker-strategy BuildConfig
- The example Dockerfile used to build a Go web app
- How to start and monitor a build in the OpenShift console
- Where to find the resulting ImageStreamTag and image metadata
- Buildah — a tool that creates and manipulates OCI-compliant container images: https://buildah.io/
- OCI (Open Container Initiative) — image format and runtime specifications: https://opencontainers.org/
Use Buildah via OpenShift BuildConfigs to produce OCI-compliant images directly inside the cluster—no local image builds required.
How Buildah and the Docker strategy work
Buildah builds images from Dockerfiles in an OCI-compliant way. It can:- Create and manipulate working containers
- Mount/unmount container root filesystems to modify contents
- Build images from Dockerfiles and other sources
BuildConfig (Docker strategy)
A Docker-strategy BuildConfig is similar to other BuildConfigs. The main differences:strategy.typeisDockerdockerStrategy.dockerfilePathpoints to the Dockerfile to execute
gowebapi:latest:
Make sure
dockerfilePath and contextDir point to the correct locations relative to the repository root. A mismatched path is a common cause of build failures.Dockerfile (example)
This repository uses a simple multi-step build for a Go web application. The Dockerfile below builds the binary and exposes port 8080:RUN go build -o main .compiles the Go app to a binary namedmain.WORKDIR /appsets the working directory for subsequent commands.EXPOSE 8080documents the port the application listens on (useful metadata in the image).
Start the build in the OpenShift console
- In the OpenShift console, go to Builds → Build Configs.
- Create a new BuildConfig and paste the YAML above (verify the
namespaceis correct). - After creating the BuildConfig, click the kebab menu next to it and choose “Start Build”.
- Monitor the build logs in the console to follow progress and troubleshoot errors.
- View the Build record (Build details show logs, steps, and build metadata).
- Inspect the ImageStreamTag (
gowebapi:latest) in the console to see image metadata such as theCMD,WORKDIR,EXPOSED PORTS, and architecture.

Troubleshooting tips
- If the build fails to find the Dockerfile, confirm
contextDiranddockerfilePathare correct. - Check network/pull errors when fetching base images (registry access and credentials).
- Use build logs to identify which step failed—Buildah emits detailed step output.
- If the image is pushed but your deployment doesn’t start, verify the container port and readiness/liveness probes.
Links and references
- Buildah: https://buildah.io/
- OCI: https://opencontainers.org/
- OpenShift Builds documentation: https://docs.openshift.com/container-platform/latest/builds/what_builds_are.html