Use streamLayeredImage
[?]
Mar 22, 2023, 7:18 PM
HFOVEKSXBYXR73OGNSLY7WIOPW72ITQPKH4CYKRGBBBHKVPT2AUACDependencies
- [2]
VUARRVTIClean up strings - [3]
X3HISPCSAdd 05-static-container - [4]
ZYNDBBN3Update some texts - [5]
42DGMBYMFix CI - [6]
P5VCQ5VEStrip small static executable - [7]
VX6OFBL3Tweak 05
Change contents
- edit in 05-static-container/podman-devshell.nix at line 7
# Provides a fake "docker" binary mapping to podmandockerCompat = pkgs.runCommandNoCC "docker-podman-compat" {} ''mkdir -p $out/binln -s ${pkgs.podman}/bin/podman $out/bin/docker''; - edit in 05-static-container/podman-devshell.nix at line 17
dockerCompat # Aliases for docker / podman - replacement in 05-static-container/flake.nix at line 32
wttr-delft-container = pkgs.dockerTools.buildImage {# Actually, this makes a script that dumps the image to stdout,# in this way we can load the data directly into Podman, without# having a copy of the image in the Nix store; for large images this is very convenient!wttr-delft-container = pkgs.dockerTools.streamLayeredImage { - replacement in 05-static-container/demo.sh at line 13
h "Build the container"h "Build the container stream" - replacement in 05-static-container/demo.sh at line 16
n "It's a lot smaller than before!"x ls -lhH ./resultn "The output is now a script:"x pygmentize -l bash ./result - replacement in 05-static-container/demo-inside-nix-develop.sh at line 12
h "We start by loading the container we just made into the registry:"x docker load -i ./resulth "We start by loading the container stream we just made into the registry:", "Just pipe it directly into podman"x "./result | podman load" - replacement in 05-static-container/demo-inside-nix-develop.sh at line 16[3.6532]→[2.728:770](∅→∅),[3.61]→[3.6558:6611](∅→∅),[2.770]→[3.6558:6611](∅→∅),[3.6558]→[3.6558:6611](∅→∅)
h "We can see it's there, and it's tiny!"x "docker image ls | grep 'wttr-delft\|^REPOSITORY'"h "We can see the final image is there, and it's tiny!"x "podman image ls | grep 'wttr-delft\|^REPOSITORY'" - edit in 05-static-container/demo-inside-nix-develop.sh at line 19
, "Some more information is available:"x "podman inspect localhost/wttr-delft:nix | pygmentize -l json" - replacement in 05-static-container/demo-inside-nix-develop.sh at line 23
x docker run -it localhost/wttr-delft:nixx "podman run -it localhost/wttr-delft:nix"