Building and Running Docker Images with nix
Use nix to reliably and repeatedly build docker images.
{ pkgs ? import <nixpkgs> { system = "x86_64-linux"; } }:
pkgs.dockerTools.buildImage {
name = "hello-docker";
config = {
Cmd = [ "${pkgs.hello}/bin/hello" ];
};
}
Then run:
nix-build hello-docer.nix
docker load < result
Or:
docker load < $(nix-build hello-docker.nix)
See docker tools for more notes or the manual for more information