Parameterizing the Container Image
Wiring image repository and tag to values.
Parameterizing the Container Image is a free DevOps Bootcamp lesson on CoddyKit. This is lesson 2 of 4. Any 3 lessons of this learning path are free to read in full — after that, CoddyKit PRO unlocks every lesson, plus hands-on practice with a built-in code editor and a 24/7 AI tutor. It is part of the DevOps Bootcamp learning path, and your progress syncs across the web and the CoddyKit app. The DevOps Bootcamp course includes 4 lessons in total.
Why Parameterize the Image
A hard-coded image locks every user to one version. Wiring the image to values lets people pick the repository and tag they need.
Split Repository and Tag
By convention charts store the image as two fields: a repository and a tag. Keeping them separate makes version bumps clean.
# values.yaml
image:
repository: nginx
tag: "1.27"Read Nested Values
Reach nested keys by chaining dots. Here .Values.image.repository walks into the image map you just defined.
image: {{ .Values.image.repository }}Join Repository and Tag
An image reference is repository, then a colon, then tag. Build it inside the template so the rendered line is a single valid string.
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"Always Quote the Tag
A tag like 1.27 can be read as a number by YAML. Quote tags in values so they stay strings and never lose a trailing zero.
tag: "1.27.0"Provide a Sensible Default Tag
The default function supplies a fallback when a value is empty. A common pattern uses the chart's appVersion as the default tag.
{{ .Values.image.tag | default .Chart.AppVersion }}Expose the Pull Policy
Let users control when Kubernetes re-pulls an image by parameterizing imagePullPolicy too. IfNotPresent is a safe default.
imagePullPolicy: {{ .Values.image.pullPolicy }}Default the Pull Policy
Set the pull policy default in values.yaml so an install works with zero overrides. Users still change it whenever they need to.
image:
pullPolicy: IfNotPresentThe Full Container Block
Now your container is fully data-driven: image and pull policy both flow from .Values.image, with no literals left in the template.
containers:
- name: app
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}Override at Install Time
Users tweak a single nested value with --set. Dots in the key map straight onto your values tree, no file edits required.
helm install web . --set image.tag=1.28Confirm the Rendered Image
Render with an override to prove the wiring works end to end. The output should show your chosen tag in the image line.
helm template web . --set image.tag=1.28Quick Check
You want to install with a different image tag without editing files. What works?
Recap: A Configurable Image
You split the image into repository and tag, added a pull policy, and let users override each with --set. Quote tags to stay safe.
Learn DevOps Bootcamp with an AI tutor — free
Write and run real code in your browser, get instant help from a 24/7 AI tutor, and pick up where you left off on the web or in the app.
- Courses
- 142
- Lessons
- 568
Frequently Asked Questions
Is the “Parameterizing the Container Image” lesson free?
Yes — any 3 lessons of the DevOps Bootcamp learning path, including “Parameterizing the Container Image”, are free to read in full here on the web. After that, CoddyKit PRO unlocks every lesson, plus interactive practice with a built-in code editor and a 24/7 AI tutor. The DevOps Bootcamp course includes 4 lessons in total.
What will I learn in “Parameterizing the Container Image”?
Wiring image repository and tag to values. You practise DevOps Bootcamp with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.
Do I need any experience to start DevOps Bootcamp?
No prior experience is required. DevOps Bootcamp on CoddyKit is structured for beginners through advanced learners, so you can start here or from the beginning and move at your own pace. This is lesson 2 of 4.
How long does the “Parameterizing the Container Image” lesson take?
Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.
Can I write and run code in this DevOps Bootcamp lesson?
Yes. Every DevOps Bootcamp lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.
All lessons in this course
- A Minimal Deployment Template
- Parameterizing the Container Image
- Adding a Service Template
- Installing and Iterating Your Chart