docker-purifier
Locked, Nix-resolved base images for Docker builds.
Quickstart
Prerequisites: a running Docker daemon, Buildx with named-context support.
From a project containing Dockerfile:
nix shell 'github:nix-purifiers/docker-purifier'
docker-purifier lock
docker-purifier prefetch
docker build .
Pass -t my-app to the build if you want to run it with docker run --rm my-app.
Commit the lockfiles: docker-purifier.lock.json.
Locking excludes .docker-purifier from the native build context. Also commit the updated ignore file.
OCI manifest, configuration, and layer identities retain their native SHA-256 digests. The lock adds platform selections and input fingerprints.
Development loop
Run docker-purifier lock after changing dependency declarations. Relocking retains existing pins.
Run docker-purifier update to update dependencies, then docker-purifier prefetch.
Update one selected dependency with docker-purifier update quay.io/prometheus/busybox:latest. Other selected pins are retained.
Using locked dependencies
The development environment supplies a wrapper that runs the build tool with the locked dependencies. Without an applicable purifier lock, it warns and lets the tool use its usual dependency resolution. A stale or invalid lock fails with a repair command.
The supplied wrapper is required for native builds.
The wrapper handles native-platform, local-context docker build, docker buildx build; other commands run normally.
Working offline
Run docker-purifier prefetch to prepare the locked dependencies. This does not guarantee that the entire build can run offline.
Outside this lock: Downloads inside Dockerfile RUN commands.
Host RUN commands retain network access. Vendor their inputs or prepare
package caches before using docker build --network=none.
Prefetch retains image layouts, Docker client, Buildx, resolver, editor worker through garbage-collector roots beside the selected lockfile.
Nix builds
Apply overlays.default and call pkgs.docker-purifier.buildDockerProject.
The result exposes: packages.image, tests, release, fetches.
The builder runs Buildah inside a networkless software VM.
Neither host root privileges nor KVM is required. Software emulation adds
overhead. Use the pinned nixpkgs or a compatible vmTools interface.
See builder configuration.
Builder options include lockFile, dockerfile, fetchers, srcFilter, buildArgs, testCommand.
Supported scope
Target systems
- x86_64-linux
- aarch64-linux
- x86_64-darwin
Dependency sources
- Public OCI/Docker v2 registries
The default CLI transport supports anonymous access. Builder fetcher overrides can integrate corporate transport.
Not supported
- remote ADD
- external syntax frontends
- ONBUILD triggers
- dynamic FROM
- explicit FROM –platform
- RUN mounts and heredocs
- foreign layers
- Compose and Bake builds
- cross-platform host builds
- remote build contexts
See troubleshooting and external locks.
Platform limits
- Linux uses the pure Buildah VM builder. Intel Darwin supports the native client workflow with an external Linux Docker daemon; this is not a Darwin pure VM builder.
More information
Setup and activation · Version compatibility · Using locked dependencies · Working offline · Language tooling integration · Troubleshooting.