Rockcraft

A rock solid foundation
for crafting containers

Build minimal, hardened, OCI-compliant Ubuntu container images with Rockcraft.

Let Rockcraft handle the boilerplate of your container builds so you can focus on your application’s code.


Why Rockcraft?

Rockcraft is Canonical’s specialized CLI tool for creating rocks, a new generation of securely-designed, stable, and OCI-compliant container images, based on Ubuntu.

Minimal setup

Rockcraft supports a variety of language-specific plugins, removing the overhead for a developer to set up their own language environment in order to build and stage their application into the final container image.


Seamless chiseling

Rockcraft integrates with Canonical’s Chisel tool to build minimal container images from slices of the Ubuntu distribution, ensuring that customers package only what is needed for their application, and nothing more.


Declarative simplicity

Rockcraft uses a declarative, rather than imperative, approach to build containers. This lowers the barrier to entry for new container developers, while saving time and reducing maintenance overhead for experienced engineers.


Ecosystem integration

Rockcraft is built on top of existing concepts within the same family as Snapcraft and Charmcraft, making adoption seamless for developers that are already building snaps and charms.


Developer workflow

Learn about some of the high-level commands you can use to build a rock, from generating the base configuration file to publishing a rock to a registry.


  1. a. Initialize (without extension)

    rockcraft init

    Run rockcraft init to generate a base rockcraft.yaml


    b. Initialize (with extension)

    rockcraft init --profile spring-boot-framework

    Rockcraft offers various extensions, including spring-boot-framework. Using the above command, Rockcraft automates the creation of a rockcraft.yaml file and tailors the file for a Spring Boot application.


  2. Declare

    # Metadata section

    name: hello
    summary: Hello World
    description: The most basic example of a rock.
    version: "latest"
    license: Apache-2.0

    base: bare
    build-base: [email protected]
    platforms:
    amd64: # Make sure this value matches your computer's architecture

    # Parts section

    parts:
    hello:
    plugin: nil
    stage-packages:
    - hello

    Define your application dependencies, base OS, and parts in the rockcraft.yaml file.


  3. Pack

    rockcraft pack

    Run rockcraft pack to process parts and create the final artefact.


  4. Publish

    rockcraft.skopeo --insecure-policy copy
    oci-archive:<your_rock_file.rock>
    docker://<container_registry>/<repo>:<tag>

    Publish a rock to a registry.


Developer-friendly,
enterprise-ready

  • Ultra-small chiseled images: Rockcraft’s native integration with Chisel means that developers can build minimal images containing only the exact dependencies the application needs to run at runtime, stripping out shells, package managers, and unused libraries.
  • Reduced attack surface: Because chiseled images contain no unused utilities or package contents, entire classes of supply-chain attacks are mitigated by default.
  • Superior init process: Rockcraft embeds Pebble as the standard entrypoint (PID 1). Pebble orchestrates services natively using declarative YAML. This prevents the security risks associated with using imperative shell scripts to manage local service processes.

Technical deep dive

Rockcraft forgoes the traditional, linear execution of Dockerfiles in favor of a declarative, component-based architecture.


The parts lifecycle

Rockcraft divides your app into modular blocks called parts. When a part is processed, it performs steps from the parts lifecycle: pull, overlay, build, stage, and prime.


Declarative chiseling

Rockcraft natively integrates with Chisel directly inside the YAML. Rather than starting with a full OS layer, developers can select the bare base and define precise slices.


Built-in plugins

You do not need to write custom build scripts or manually configure virtual environments. Rockcraft handles ecosystem-specific build logic natively through its plugin ecosystem.


12-factor app ready

Rockcraft provides built-in extensions for modern cloud-native web apps (Django, Flask, FastAPI, Node.js, Go), which silently inject a pre-configured underlying part.


Try it out for yourself

Get started with Rockcraft.