4 ms·
Yes, you can do that using for example `buildLayeredImage`: { pkgs ? import <nixpkgs> {} }: with pkgs; dockerTools.buildLayeredImage { name = "curl-
by tazjin 7y ago
Yes, you can do that using for example `buildLayeredImage`:
{ pkgs ? import <nixpkgs> {} }:
with pkgs; dockerTools.buildLayeredImage {
name = "curl-bash";
contents = [ curl bashInteractive coreutils ];
}
Putting that in a file and calling `nix-build` on that file will give you a tarball that Docker will happily load using `docker load`.
Doing this has a lot of advantages over Dockerfiles, see this blog post for some of the others: https://grahamc.com/blog/nix-and-layered-docker-images https://grahamc.com/blog/nix-and-layered-docker-images
- StavrosK 7y agoFantastic, thanks!