nix2container

An archive-less dockerTools.buildImage implementation (by nlewo)

Nix2container Alternatives

Similar projects and alternatives to nix2container

  1. nixpkgs

    Nix Packages collection & NixOS

  2. InfluxDB

    InfluxDB – Built for High-Performance Time Series Workloads. InfluxDB 3 OSS is now GA. Transform, enrich, and act on time series data directly in the database. Automate critical tasks and eliminate the need to move data externally. Download now.

    InfluxDB logo
  3. k3s

    Lightweight Kubernetes

  4. Moby

    The Moby Project - a collaborative project for the container ecosystem to assemble container-based systems

  5. dagger

    An open-source runtime for composable workflows. Great for AI agents and CI/CD. (by dagger)

  6. devenv

    Fast, Declarative, Reproducible, and Composable Developer Environments using Nix

  7. pack

    CLI for building apps using Cloud Native Buildpacks

  8. jib

    🏗 Build container images for your Java applications.

  9. SaaSHub

    SaaSHub - Software Alternatives and Reviews. SaaSHub helps you find the best software and product alternatives

    SaaSHub logo
  10. buildah

    A tool that facilitates building OCI images.

  11. postgres

    Docker Official Image packaging for Postgres (by docker-library)

  12. stage0

    A set of minimal dependency bootstrap binaries

  13. krustlet

    Kubernetes Rust Kubelet

  14. crate2nix

    rebuild only changed crates in CI with crate2nix and nix

  15. cargo-chef

    A cargo-subcommand to speed up Rust Docker builds using Docker layer caching.

  16. nixery

    Container registry which transparently builds images using the Nix package manager. Canonical repository is https://cs.tvl.fyi/depot/-/tree/tools/nixery

  17. nixpacks

    App source + Nix packages + Docker = Image

  18. naersk

    Build Rust projects in Nix - no configuration, no code generation, no IFD, sandbox friendly.

  19. official-images

    Primary source of truth for the Docker "Official Images" program

  20. cargo2nix

    Granular builds of Rust projects for Nix

  21. plane

    A distributed system for running WebSocket services at scale. (by jamsocket)

  22. conda-docker

    Create minimal docker images from conda environments

  23. SaaSHub

    SaaSHub - Software Alternatives and Reviews. SaaSHub helps you find the best software and product alternatives

    SaaSHub logo
NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a better nix2container alternative or higher similarity.

nix2container discussion

Log in or Post with

nix2container reviews and mentions

Posts with mentions or reviews of nix2container. We have used some of these posts to build our list of alternatives and similar projects. The last one was on 2025-06-07.
  • Why We're Moving on from Nix
    8 projects | news.ycombinator.com | 7 Jun 2025
    > With no way of splitting up the Nix dependencies into separate layers

    nix2container [1] is actually able to do that: you can explicitly build layers containing a subset of the dependencies required by your image. An example is provided in this section: https://github.com/nlewo/nix2container?tab=readme-ov-file#is...

    For instance, if your images use bash, you can explicitly create a layer containing the bash closure. This layer can then be used across all your images and is only rebuild and repushed if this bash closure is modified.

    > > pull in dependencies often results in massive image sizes with a single /nix/store layer

    This is the case for the basic nixpkgs.dockerTools.buildImage function but this is not true with nix2container, nor with nixpkgs.dockerTools.streamLayeredImage. Instead of writing the layers in the Nix store, these tools build a script to actually push the image by using existing store paths (which are Nix runtime dependencies of this script). Regarding the nix2container implementation, it builds a JSON file describing the Nix store paths for all layers and uses Skopeo to push the image (to a Docker deamon, a registry, podman, ...), by consuming this JSON file.

    (disclaimer: i'm the nix2container author)

    [1] https://github.com/nlewo/nix2container

  • Dagger Shell: Unix Pipeline Pattern for Typed API Objects
    8 projects | news.ycombinator.com | 27 Mar 2025
  • Nix is a better Docker image builder than Docker's image builder
    21 projects | news.ycombinator.com | 15 Mar 2024
    No discussion about Nix-built containers is complete with nix2container:

    https://github.com/nlewo/nix2container

    It is truly magical for handling large, multi-layered containers. Instead of building the container archives themselves and storing them in the nix store, it builds a JSON manifest that is consumed by a lightly patched version of skopeo that streams the layers directly to either your local container engine or the registry.

    This means you never rebuild or reupload a container layer that is unchanged.

  • Way to get NVM working in CI/CD systems
    6 projects | news.ycombinator.com | 19 May 2023
    - Container images are built with https://github.com/nlewo/nix2container instead of Nix's built-in docker tools, because nix2container allows configuration of layers and thus makes it easier to share layers between images and improve layer caching.

    As for integrating it into our CI pipeline, this is pretty much CI system agnostic as all you have to do is run `nix build ...` inside the pipeline, generating a `result` directory or file as an artifact that, in the case of nix2container, can be pushed to your container image registry.

  • How do I create a docker image for postgres with nix?
    4 projects | /r/NixOS | 10 Mar 2023
    dockerTools is the canonical way, but https://github.com/nlewo/nix2container seems to be gaining support as it's faster and doesn't use so much disk space while building.
  • We deploy 5X faster with warm Docker containers
    3 projects | news.ycombinator.com | 7 Mar 2023
    > The key factor behind our decision was the realization that while Docker images are industry standard, moving around 100s of megabytes of images seems unnecessarily heavy-handed when we just need to synchronize a small change.

    I think the culprit is more the GitHub Actions cache than Docker since it seems to be hard to get a clean cache management. I'm not sure about caching Docker image layers, but caching the Nix store with GitHub Actions is pretty complicated (not even sure it's possible): this means we have to download all required Nix store paths on each run, but i consider this is because of a GitHub Action cache limitation.

    So, did you consider using another CI, which offers better caching mechanisms?

    With a CI able to preserve the Nix store (Hydra[1] or Hercules[2] for instance), I think nix2container (author here) could also fit almost all of your requirements ("composability", reproducibility, isolation) and maybe provide better performances because it is able to split your application into several layers [2][3].

    Note i'm pretty sure a lot of Docker CI also allows to efficiently build Docker images.

    [1] https://hercules-ci.com/

    [2] https://grahamc.com/blog/nix-and-layered-docker-images

    [3] https://github.com/nlewo/nix2container/blob/85670cab354f7df6...

  • Launch HN: Depot (YC W23) – Fast Docker Images in the Cloud
    6 projects | news.ycombinator.com | 22 Feb 2023
    FYI, the nix2container [1] project (author here) aims to speedup the standard Nix container workflow (dockerTools.buildImage) by basically skipping the tarball step: it directly streams non already pushed layers.

    [1] https://github.com/nlewo/nix2container

  • Crafting container images without Dockerfiles
    20 projects | news.ycombinator.com | 6 Feb 2023
    To get Rust incremental builds, did you consider using something such as crane https://github.com/ipetkov/crane ?

    And regarding OCI images, i built nix2container (https://github.com/nlewo/nix2container) to speed up image build and push times.

  • Optimising Docker Layers for Better Caching with Nix (2018)
    2 projects | news.ycombinator.com | 11 Sep 2022
    For a more modern iteration of that idea, check out https://github.com/nlewo/nix2container

    It has all the benefits of OP but produces the images much faster, and with less on-disk usage.

  • Nixpacks takes a source directory and produces an OCI compliant image
    7 projects | news.ycombinator.com | 17 Aug 2022
    I've been using nix2container[1] for awhile now. It looks like this depends on Docker, have you guys considered removing that dependency? It shouldn't be necessary to create an OCI compliant image with Nix.

    [1]: https://github.com/nlewo/nix2container

  • A note from our sponsor - SaaSHub
    www.saashub.com | 23 Jun 2025
    SaaSHub helps you find the best software and product alternatives Learn more →

Stats

Basic nix2container repo stats
11
661
5.8
18 days ago

Sponsored
InfluxDB – Built for High-Performance Time Series Workloads
InfluxDB 3 OSS is now GA. Transform, enrich, and act on time series data directly in the database. Automate critical tasks and eliminate the need to move data externally. Download now.
www.influxdata.com

Did you know that Go is
the 4th most popular programming language
based on number of references?