---
title: "Rockcraft – Canonical’s CLI tool for container images\n    | Ubuntu"
description: Discover Rockcraft and get started building minimal, hardened, OCI-compliant
  Ubuntu container images.
url: https://ubuntu.com/containers/rockcraft?format=md
keywords: index, follow
---

# 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.

[Read the docs](https://ubuntu.com/containers/rockcraft/docs/latest/)

---

## 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.

[Learn more about rocks ›](https://ubuntu.com/containers/rockcraft/docs/latest/explanation/rocks/)

### 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](https://ubuntu.com/chisel/docs/latest/) 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](https://ubuntu.com/docs/snapcraft/9/)
and [Charmcraft](https://canonical.com/juju/docs/charmcraft/4/), 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`

   [Follow our quickstart guide ›](https://ubuntu.com/containers/rockcraft/docs/latest/how-to/get-started/)

   ---

   ### 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.

   [Build a rock for a Spring Boot application ›](https://ubuntu.com/containers/rockcraft/docs/latest/tutorial/springboot/)

---

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: ubuntu@26.04
   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.

   [Learn more about rockcraft.yaml files ›](https://ubuntu.com/containers/rockcraft/docs/latest/reference/rockcraft-yaml/)

---

3. ### Pack

   ```
   rockcraft pack
   ```

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

   [Read more about Rockcraft commands ›](https://ubuntu.com/containers/rockcraft/docs/latest/reference/)

---

4. ### Publish

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

   Publish a rock to a registry.

   [Learn more about publishing rocks ›](https://ubuntu.com/containers/rockcraft/docs/latest/how-to/crafting/publish-a-rock/)

---

## Developer-friendly, enterprise-ready

Cloud-native developers

Independent software vendors

Individual developers

* **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.

* **Streamlined CI/CD:** Rockcraft integrates directly with GitHub Actions (through the Rockcraft Pack action), and allows you to outsource remote builds to Canonical’s Launchpad build farm.
* **No heavy lifting:** Instead of writing messy wrapper scripts to manage how your application starts, Rockcraft uses Pebble as the built-in entrypoint. It automatically handles signal forwarding, graceful shutdowns, and log rotation for you.
* **Cross-compilation made easy:** Need to ship your app for ARM servers or Raspberry Pis? Rockcraft handles cross-compilation seamlessly without requiring you to maintain separate build environments.

* **No more boilerplate:** You don't need to string together complex shell scripts or worry about the exact order of `RUN`, `APT`, and `ENV` commands. Rockcraft uses a clean, declarative `rockcraft.yaml` file that handles the boilerplate for you.
* **Quick start with extensions:** Rockcraft includes built-in extensions for 12-factor apps. Just tell Rockcraft which framework you are using, and it automatically configures the environment, dependencies, and entrypoints.
* **Familiar Ubuntu environment:** If you know how to use Ubuntu, you know how to use Rockcraft. The underlying bases are the exact same Ubuntu LTS releases you are used to, meaning your code runs the same way in the container as it does on your local machine.

---

## 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*.

[Learn more about parts ›](https://ubuntu.com/containers/rockcraft/docs/latest/common/craft-parts/explanation/parts/)

---

Declarative chiseling

Rockcraft natively integrates with [Chisel](https://ubuntu.com/chisel/docs/latest/) directly inside the YAML. Rather than starting with a full OS layer, developers can select the `bare` base and define precise slices.

[Learn about rockcraft.yaml ›](https://ubuntu.com/containers/rockcraft/docs/latest/reference/rockcraft-yaml/)

---

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.

[Explore Rockcraft plugins ›](https://ubuntu.com/containers/rockcraft/docs/latest/reference/plugins/)

---

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.

[Set up a 12-factor app rock ›](https://ubuntu.com/containers/rockcraft/docs/latest/how-to/web-app-rocks/set-up-web-app-rock/)

---

## Try it out for yourself

Get started with Rockcraft.

[Try the tutorials](https://ubuntu.com/containers/rockcraft/docs/latest/tutorial/)
[Read the how-to guides](https://ubuntu.com/containers/rockcraft/docs/latest/how-to/)
[Explore the GitHub repo ›](https://github.com/canonical/rockcraft)
