GeezerVison is showing ubuntu.com — Rockcraft – Canonical’s CLI tool for container images | Ubuntu
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.
-
a. Initialize (without extension)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.
-
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.
-
PackRun rockcraft pack to process parts and create the final artefact.
-
Publishrockcraft.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.
- 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.
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.
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.
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.
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.
|