Bases

One mandatory field for every rock project is the base.

This field defines the baseline system upon which the rock’s contents shall be layered on. Only Ubuntu and bare bases are supported.

Ubuntu bases

When setting an Ubuntu base for a rock, Rockcraft will pull the corresponding Ubuntu base container image from a container registry. This is exactly the same container one would get from places like Docker Hub or Amazon ECR.

The resulting rock will therefore also contain any software and utilities that are present in the Ubuntu base container images.

Setting an Ubuntu base for a rock is especially useful when the goal is to build a rock that can be used for general-purpose environments such as a development working space.

Bare bases

As the name suggests, a bare base indicates that the rock shall have no baseline system. This definition is similar to the “scratch” Docker image, with the exception that a rock can never be completely empty, as it must always include a minimum baseline with Pebble and additional metadata (What sets rocks apart?).

When and how to use a bare base

The bare base is extremely useful when the goal is to build a lean chiselled rock. Such rocks are typically preferred for production environments due to their optimised deployment efficiency and reduced attack surface. The combination of the bare base with Chisel slices will result in a minimalist container image that meets the production environment’s criteria while retaining its functionality.

Note that, when using the bare base, the rock will still be Ubuntu-based! As such, Rockcraft needs to know the Ubuntu release to be used as the build environment for the rock.

For example, if the goal is to have a tiny chiselled rock with software components coming from the Ubuntu 24.04 release, then the rockcraft.yaml file must have base: bare and build-base: ubuntu@24.04.

The guide “How to chisel an existing rock” provides a practical example on how to start from a rock with an Ubuntu base and apply the changes necessary to build a chiselled rock with a bare base.