packaged by Chainguard
Contact our team to test out this image for free. Please also indicate any other images you would like to evaluate.
Nix is a package manager that builds and installs software reproducibly into a content-addressed store.
Chainguard Containers are regularly-updated, secure-by-default container images.
For those with access, this container image is available on cgr.dev:
Be sure to replace the ORGANIZATION placeholder with the name used for your organization's private repository within the Chainguard Registry.
Nix installs binaries from its own substituters, most commonly cache.nixos.org. Those binaries are built and signed by the Nix project, not by Chainguard. Anything you add to the store this way sits outside CVE remediation and SLAs, FIPS enforcement, SLSA provenance, and scanner coverage, and it will bring its own vendored copies of libraries the image already provides.
That applies to the packages Nix installs, not to this container image. The image itself, and the nix binary in it, are built and maintained by Chainguard on the usual terms. If you need a dependency covered by those terms, request it as a Chainguard package rather than installing it with Nix.
This image is comparable to the upstream nixos/nix image and keeps its shape: no entrypoint, a Bash shell as the default command, and Nix on PATH. It differs in four ways.
It runs as a non-root user. Upstream runs as 0:0 from /. This image runs as UID/GID 65532 from /home/nonroot, which it owns along with /nix. Single-user Nix works normally, but anything expecting to write outside those paths needs --user 0 or a mounted volume you own.
Nix is installed as an APK, not into the store. The binary is at /usr/bin/nix, with the usual nix-build, nix-store, nix-env, nix-shell and friends beside it. Scripts that hard-code /nix/var/nix/profiles/default/bin/nix will not find it; call nix from PATH instead.
The store starts empty and no channel is configured. Upstream bundles a nixpkgs channel, so nix-env -iA nixpkgs.hello works offline. Here the first operation that needs a package reaches out to cache.nixos.org, and <nixpkgs> does not resolve until you add a channel:
nix develop and nix-shell -p need that channel too, since both resolve Bash from nixpkgs; they fail until a channel or flake registry is available. Bash itself is present for the interactive shell.
Core utilities come from BusyBox. Upstream bundles the GNU builds of coreutils, tar, gzip, grep and which, because everything in that image lives in /nix/store and without them an interactive shell would have no ls. This image has a real base filesystem and supplies the BusyBox applets instead, which cover the common invocations but not every GNU-only flag. This affects an interactive shell and RUN steps in a downstream Dockerfile. It does not affect builds: Nix runs builders with PATH=/path-not-set, so a derivation sees only the tools its own inputs provide.
Nix builds in this image run unsandboxed, because a container has no CAP_SYS_ADMIN to build a sandbox with. If you need sandboxed builds, run Nix on a host that can provide the required privileges.
The store lives in the container's writable layer and disappears with the container. Mount a volume at /nix to keep it across runs.
Start a shell, the same way you would with the upstream image:
Evaluate an expression and build a derivation:
Keep the store across runs by mounting a volume at /nix. The volume has to be writable by UID 65532:
The image ships /etc/nix/nix.conf with the two settings a container needs:
An empty build-users-group puts Nix in single-user mode, building as the calling user, because an APK cannot create the nixbld accounts a multi-user install expects. sandbox = false follows from the missing CAP_SYS_ADMIN.
Experimental features are off, matching upstream. To use flakes and the nix CLI's newer subcommands, enable them per invocation:
Or set them for every invocation with NIX_CONFIG, which is the better choice when you are driving the image from CI and do not want the flag on each command:
Chainguard's free tier of Starter container images are built with Wolfi, our minimal Linux undistro.
All other Chainguard Containers are built with Chainguard OS, Chainguard's minimal Linux operating system designed to produce container images that meet the requirements of a more secure software supply chain.
The main features of Chainguard Containers include:
For cases where you need container images with shells and package managers to build or debug, most Chainguard Containers come paired with a development, or -dev, variant.
In all other cases, including Chainguard Containers tagged as :latest or with a specific version number, the container images include only an open-source application and its runtime dependencies. These minimal container images typically do not contain a shell or package manager.
Although the -dev container image variants have similar security features as their more minimal versions, they include additional software that is typically not necessary in production environments. We recommend using multi-stage builds to copy artifacts from the -dev variant into a more minimal production image.
To improve security, Chainguard Containers include only essential dependencies. Need more packages? Chainguard customers can use Custom Assembly to add packages, either through the Console, chainctl, or API.
To use Custom Assembly in the Chainguard Console: navigate to the image you'd like to customize in your Organization's list of images, and click on the Customize image button at the top of the page.
Refer to our Chainguard Containers documentation on Chainguard Academy. Chainguard also offers VMs and Libraries — contact us for access.
This software listing is packaged by Chainguard. The trademarks set forth in this offering are owned by their respective companies, and use of them does not imply any affiliation, sponsorship, or endorsement by such companies.
Chainguard's container images contain software packages that are direct or transitive dependencies. The following licenses were found in the "latest" tag of this image:
( Artistic-1.0-Perl
Apache-2.0
BSD-2-Clause
BSD-3-Clause
BSL-1.0
Boehm-GC
CC0-1.0
For a complete list of licenses, please refer to this Image's SBOM.
Software license agreementChainguard Containers are SLSA Level 3 compliant with detailed metadata and documentation about how it was built. We generate build provenance and a Software Bill of Materials (SBOM) for each release, with complete visibility into the software supply chain.
SLSA compliance at ChainguardThis image helps reduce time and effort in establishing PCI DSS 4.0 compliance with low-to-no CVEs.
PCI DSS at Chainguard