Skip to content

Defining your rock

Alex Santisteban edited this page Oct 22, 2026 · 3 revisions

The rock is defined by a rockcraft.yaml file. This page covers the parts of it that matter to the template's CI; for everything else, refer to the Rockcraft documentation.

A minimal rockcraft.yaml

name: my-rock-name
base: ubuntu@24.04          # see https://ubuntu.com/containers/rockcraft/docs/latest/explanation/bases/
version: '0.1'              # just for humans; semantic versioning is recommended
summary: Single-line elevator pitch for your amazing rock    # max 79 characters
description: |
    A paragraph or two about your rock. Keep it under 100 words: it will be
    displayed by the container registries.
platforms:
    amd64:

parts:
    my-part:
        plugin: nil

Use base: bare together with a build-base to create chiseled rocks.

Fields the CI relies on

The CI reads these fields of your rockcraft.yaml:

Field Used for
name The image name in the registry.
version The first part of the image tag.
base (and build-base when base: bare) The second part of the image tag. It must contain an Ubuntu release such as 24.04 or devel.
platforms The architectures to build. One build job runs per platform and the results are assembled into a multi-architecture image.

Image names and tags

The published image reference is derived from the rock, not from its directory:

<registry>/<name>:<version>-<base>_edge
Example rockcraft.yaml Published tag
name: my-rock, version: '0.1', base: ubuntu@24.04 my-rock:0.1-24.04_edge
name: my-rock, version: '2.4', base: bare, build-base: ubuntu@22.04 my-rock:2.4-22.04_edge
  • For GHCR, <registry> is ghcr.io/<owner>/<repository>.
  • For additional registries, <registry> is the uri you configured.
  • The _edge suffix is fixed.

Warning

If the base does not contain a recognizable Ubuntu release (NN.NN, NN@NN or devel), the validation step fails. See Troubleshooting for guidance on how to solve this.

Platforms

Declare only the architectures you want to build and support.

platforms:
    amd64:
    arm64:

Note

Github hosted runners are currently available for amd64 and arm64, other architectures such as s390x or ppc64el will require self-hosted runners.

Building locally

Install Rockcraft and LXD (or Multipass), then pack the rock from the directory containing the rockcraft.yaml:

sudo snap install rockcraft --classic
sudo snap install lxd
rockcraft pack

This produces a <name>_<version>_<arch>.rock file (ignored by the template's .gitignore). To try it out with Docker, run:

sudo rockcraft.skopeo --insecure-policy copy \
    oci-archive:my-rock-name_0.1_amd64.rock \
    docker-daemon:my-rock-name:latest
docker run --rm my-rock-name:latest

Tip

Running rockcraft pack locally is the quickest way to find recipe errors. The CI uses the same Rockcraft build step, so a rock that packs locally will normally pack in the CI too.

Clone this wiki locally