summary refs log tree commit diff
path: root/doc
diff options
context:
space:
mode:
authorSteve Purcell <steve@sanityinc.com>2020-06-22 15:11:46 +1200
committerUtku Demir <me@utdemir.com>2020-06-22 15:19:44 +1200
commitc9e6a02c822936b2d9156151031f40d6c2e5435d (patch)
tree2e4d93d0954761535aa74d76aec27e2b9f15a7ec /doc
parentfa8f2bf34f3f065571670c59217f877a73868f8f (diff)
downloadnixpkgs-c9e6a02c822936b2d9156151031f40d6c2e5435d.tar
nixpkgs-c9e6a02c822936b2d9156151031f40d6c2e5435d.tar.gz
nixpkgs-c9e6a02c822936b2d9156151031f40d6c2e5435d.tar.bz2
nixpkgs-c9e6a02c822936b2d9156151031f40d6c2e5435d.tar.lz
nixpkgs-c9e6a02c822936b2d9156151031f40d6c2e5435d.tar.xz
nixpkgs-c9e6a02c822936b2d9156151031f40d6c2e5435d.tar.zst
nixpkgs-c9e6a02c822936b2d9156151031f40d6c2e5435d.zip
Add docs for dockerTools.streamLayeredImage
Diffstat (limited to 'doc')
-rw-r--r--doc/builders/images/dockertools.xml23
1 files changed, 22 insertions, 1 deletions
diff --git a/doc/builders/images/dockertools.xml b/doc/builders/images/dockertools.xml
index e7f37fdaaf0..126698d0a9e 100644
--- a/doc/builders/images/dockertools.xml
+++ b/doc/builders/images/dockertools.xml
@@ -166,7 +166,7 @@ hello        latest   de2bf4786de6   About a minute ago   25.2MB
   <title>buildLayeredImage</title>
 
   <para>
-   Create a Docker image with many of the store paths being on their own layer to improve sharing between images.
+   Create a Docker image with many of the store paths being on their own layer to improve sharing between images. The image is realized into the Nix store as a gzipped tarball. Depending on the intended usage, many users might prefer to use <function>streamLayeredImage</function> instead, which this function uses internally.
   </para>
 
   <variablelist>
@@ -327,6 +327,27 @@ pkgs.dockerTools.buildLayeredImage {
   </section>
  </section>
 
+ <section xml:id="ssec-pkgs-dockerTools-streamLayeredImage">
+  <title>streamLayeredImage</title>
+
+  <para>
+   Builds a script which, when run, will stream an uncompressed tarball of a Docker image to stdout. The arguments to this function are as for <function>buildLayeredImage</function>. This method of constructing an image does not realize the image into the Nix store, so it saves on IO and disk/cache space, particularly with large images.
+  </para>
+
+  <para>
+    The image produced by running the output script can be piped directly into <command>docker load</command>, to load it into the local docker daemon:
+    <screen><![CDATA[
+$(nix-build) | docker load
+    ]]></screen>
+  </para>
+  <para>
+    Alternatively, the image be piped via <command>gzip</command> into <command>skopeo</command>, e.g. to copy it into a registry:
+    <screen><![CDATA[
+$(nix-build) | gzip --fast | skopeo copy docker-archive:/dev/stdin docker://some_docker_registry/myimage:tag
+    ]]></screen>
+  </para>
+ </section>
+
  <section xml:id="ssec-pkgs-dockerTools-fetchFromRegistry">
   <title>pullImage</title>