chisel
This repository contains a minimal build for the canonical chisel application
10K+
A Docker image for Canonical's Chisel, a powerful tool that creates minimal container images by cutting out unnecessary components from a base Ubuntu image.
Chisel is a tool developed by Canonical that allows you to create minimal container images by selectively including only the components you need from a base Ubuntu image. This results in:
latest: The most recent build of the imagelatest-hardened: The most recent hardened buildv1.1.0: Full version of Chiselv1.1.0-hardened: Full version of Chisel with hardened configurationv1.1.0-ubuntu24.04: Specific Chisel version on specific Ubuntu versionv1.1.0-ubuntu24.04-hardened: Hardened version for specific Chisel and Ubuntu versionsFor a complete list of tags, see the Docker Hub Tags page.
# Pull the latest image
docker pull wagtaildigital/chisel:latest
# Run Chisel
docker run --rm wagtaildigital/chisel
# Create a minimal image with specific packages
docker run --rm -v $(pwd)/output:/rootfs wagtaildigital/chisel cut \
--release ubuntu-24.04 \
--root /rootfs \
--arch amd64 \
base-files_base \
ca-certificates_data \
bash_bins
# Create a directory for the output
mkdir -p my-minimal-image
# Run Chisel to create a minimal base image
docker run --rm -v $(pwd)/my-minimal-image:/rootfs wagtaildigital/chisel cut \
--release ubuntu-24.04 \
--root /rootfs \
--arch amd64 \
base-files_base \
base-files_release-info \
ca-certificates_data \
libc6_libs \
bash_bins \
coreutils_bins
# Use the minimal image in a Dockerfile
cat > Dockerfile << EOF
FROM scratch
COPY my-minimal-image /
CMD ["/bin/bash"]
EOF
# Build your minimal image
docker build -t my-minimal-image .
# First stage: Use Chisel to create a minimal filesystem
FROM wagtaildigital/chisel:v1.1.0 AS chisel
RUN mkdir -p /rootfs
RUN chisel cut --release ubuntu-24.04 --root /rootfs --arch amd64 \
base-files_base \
ca-certificates_data \
libc6_libs \
python3-minimal_bins \
python3-minimal_libs
# Second stage: Create the final image from the minimal filesystem
FROM scratch
COPY --from=chisel /rootfs /
COPY ./app /app
WORKDIR /app
CMD ["python3", "app.py"]
The Docker image can be configured using the following build arguments:
| Argument | Description | Default |
|---|---|---|
OS | Base operating system | ubuntu |
UBUNTU_VERSION | Ubuntu version | 24.04 |
APP_VERSION | Chisel version | v1.1.0 |
APP_BRANCH | Chisel branch | feature/update-go-1.23 |
APP_REPO | Chisel repository URL | https://github.com/nilsdebruin/chisel.git |
HARDENED | Whether to use hardened configuration | true |
Issue: Error when running Chisel: "failed to cut: no such package"
Solution: Make sure you're specifying valid package names. You can find available packages by running chisel list-slice-content.
Issue: Permission denied when writing to the output directory
Solution: Make sure the directory has the correct permissions or run the container with the appropriate user.
This project is licensed under the MIT License.
The source code for this Docker image is available on GitHub.
Content type
Image
Digest
sha256:26de19e53…
Size
16 MB
Last updated
3 days ago
docker pull wagtaildigital/chisel:latest-hardened