Sub topic 4
Reading and building oci:// references
This chapter assumes you can install a chart with Helm, read Chart.yaml, and have Helm 3.8 or later. It also assumes you know what a container registry is. The goal is to read any oci:// reference and build a correct one without trial and error.
The anatomy of a reference
An OCI chart reference is a URL that starts with the oci:// scheme. After the scheme come the registry host, a repository path, and the chart name:
oci://registry.example.com/charts/myapp
└──── host ───────┘└ path ┘└ name ┘The version does not appear in the URL. You pass it separately with --version. This differs from container images, where image:tag puts the tag in the reference.
| Part | Example | Where it comes from |
|---|---|---|
| Scheme | `oci://` | Required. Tells Helm to use the registry protocol, not an HTTP repository. |
| Host | `registry.example.com` | The registry. A port is allowed, such as `localhost:5000`. |
| Path | `charts` | A namespace you choose. It can have several segments. |
| Chart name | `myapp` | The `name` field in `Chart.yaml`. |
| Version | `0.1.0` | The `version` field in `Chart.yaml`, passed with `--version`. |
Push and pull use different references
The two directions differ, and this is the most common source of confusion.
helm pushtakes the path without the chart name. Helm appends the name from the archive and uses the chart version as the tag.helm pull,helm show, andhelm installtake the path with the chart name.
Suppose Chart.yaml contains this:
apiVersion: v2
name: myapp
description: Example application chart
type: application
version: 0.1.0
appVersion: "1.0.0"Package and push it:
helm package ./myapp
# Successfully packaged chart and saved it to: /path/to/myapp-0.1.0.tgz
helm registry login registry.example.com --username alice
helm push myapp-0.1.0.tgz oci://registry.example.com/charts
# Pushed: registry.example.com/charts/myapp:0.1.0
# Digest: sha256:...The push target ends at charts. The output shows the final location: repository registry.example.com/charts/myapp, tag 0.1.0.
Now consume it. The reference ends at myapp, and the version is a flag:
helm show chart oci://registry.example.com/charts/myapp --version 0.1.0
helm pull oci://registry.example.com/charts/myapp --version 0.1.0
helm install my-release oci://registry.example.com/charts/myapp --version 0.1.0If you omit --version, Helm resolves the latest tag it can find. Pass the version explicitly in scripts so results are repeatable.
References in Chart.yaml dependencies
A dependency follows the push-style rule. The repository field holds the path that contains the chart, and the name field supplies the chart name:
dependencies:
- name: myapp
version: 0.1.0
repository: oci://registry.example.com/chartsDo not write oci://registry.example.com/charts/myapp in repository. Helm would look for a chart named myapp under charts/myapp, and the lookup would fail.
Common mistakes
- Adding the chart name to
helm push. Pushing tooci://registry.example.com/charts/myappcreatescharts/myapp/myapp:0.1.0. The chart then lives one level deeper than you intended. - Putting the tag in the URL. A reference like
oci://registry.example.com/charts/myapp:0.1.0is the container image style. Use--versionfor pull, show, and install. - Using
https://or omitting the scheme. Withoutoci://, Helm treats the value as an HTTP repository or a local path. - Uppercase letters in the path. Registry repository names must be lowercase. This matters with registries such as GitHub Container Registry, where an organization name may contain capitals.
Exercise
You run helm push myapp-2.3.1.tgz oci://registry.example.com/team/charts. The chart's name is myapp. What helm install reference and version flag install this chart?
Show answer
Use helm install my-release oci://registry.example.com/team/charts/myapp --version 2.3.1. Helm appended the chart name to the push path, and the chart version 2.3.1 became the tag.
Exercise
A dependency entry has repository: oci://registry.example.com/team/charts/myapp and name: myapp. Why does dependency resolution fail, and how do you fix it?
Show answer
The repository field must not include the chart name, because Helm adds the value of name. Change it to oci://registry.example.com/team/charts.