Skip to content

Instantly share code, notes, and snippets.

@grahamc
Last active December 4, 2018 17:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save grahamc/5333e12cf813c81a481c6852e0acf072 to your computer and use it in GitHub Desktop.
Save grahamc/5333e12cf813c81a481c6852e0acf072 to your computer and use it in GitHub Desktop.
let pkgs = import <nixpkgs> {}; in
# 11. Create an image on top of a layered image
pkgs.dockerTools.buildImage {
name = "mutable-directory";
tag = "latest";
extraCommands = ''
mkdir ./example-output
chmod 777 ./example-output
'';
config.Cmd = [ "${pkgs.bash}/bin/bash"
"-c" "export PATH=${pkgs.coreutils}/bin/; mkdir /example-output/hi-there; ls -la /; ls -la /example-output"];
}
# nix-build ./example.nix && docker load < ./result && docker run --user 1000:1000 -it --rm mutable-directory:latest
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment