OpenShift Source To Image Explained¶
Introduction¶
OpenShift builds convert source code or Dockerfile input into an image and usually publish it to an ImageStreamTag. Troubleshooting starts with the BuildConfig, then the latest Build, logs, and output image.
Core Concepts¶
OpenShift builds on Kubernetes with projects, Routes, ImageStreams, Builds, Operators, SCCs, and integrated platform administration.
Practical Examples¶
oc get buildconfig web -n app
oc start-build web -n app --follow
oc logs -f build/web-1 -n app
oc get imagestreamtag web:latest -n app
Example output:
NAME TYPE FROM LATEST
web Source Git@main 1
NAME TYPE FROM STATUS STARTED DURATION
web-1 Source Git@main Complete 2 minutes ago 1m10s
Example YAML¶
apiVersion: build.openshift.io/v1
kind: BuildConfig
metadata:
name: web
spec:
source:
git:
uri: https://github.com/example/web.git
strategy:
sourceStrategy:
from:
kind: ImageStreamTag
name: nodejs:18-ubi8
output:
to:
kind: ImageStreamTag
name: web:latest
Verification¶
oc describe buildconfig web -n app
oc logs build/web-1 -n app
oc get istag web:latest -n app
Common Mistakes¶
- Checking the Deployment before confirming the build produced an image.
- Using --follow and missing the final Build status.
- Forgetting that a BuildConfig trigger may start a new build automatically.
Quick Checklist¶
- Confirm the active project.
- Inspect the exact object named in the error.
- Read recent events.
- Apply one focused fix.
- Verify status after the change.
Related Guides¶
Summary¶
OpenShift Source To Image Explained is best understood through the OpenShift objects involved and the oc commands that verify their current state.