3
0
Fork 0
forked from mirrors/nixpkgs
nixpkgs/doc
Graham Christensen 4fe9006190 dockerTools.buildLayeredImage: init
Create a many-layered Docker Image.

Implements much less than buildImage:

 - Doesn't support specific uids/gids
 - Doesn't support runninng commands after building
 - Doesn't require qemu
 - Doesn't create mutable copies of the files in the path
 - Doesn't support parent images

If you want those feature, I recommend using buildLayeredImage as an
input to buildImage.

Notably, it does support:

 - Caching low level, common paths based on a graph traversial
   algorithm, see referencesByPopularity in
   0a80233487993256e811f566b1c80a40394c03d6
 - Configurable number of layers. If you're not using AUFS or not
   extending the image, you can specify a larger number of layers at
   build time:

       pkgs.dockerTools.buildLayeredImage {
         name = "hello";
         maxLayers = 128;
         config.Cmd = [ "${pkgs.gitFull}/bin/git" ];
       };

 - Parallelized creation of the layers, improving build speed.
 - The contents of the image includes the closure of the configuration,
   so you don't have to specify paths in contents and config.

   With buildImage, paths referred to by the config were not included
   automatically in the image. Thus, if you wanted to call Git, you
   had to specify it twice:

       pkgs.dockerTools.buildImage {
         name = "hello";
         contents = [ pkgs.gitFull ];
         config.Cmd = [ "${pkgs.gitFull}/bin/git" ];
       };

   buildLayeredImage on the other hand includes the runtime closure of
   the config when calculating the contents of the image:

       pkgs.dockerTools.buildImage {
         name = "hello";
         config.Cmd = [ "${pkgs.gitFull}/bin/git" ];
       };

Minor Problems

 - If any of the store paths change, every layer will be rebuilt in
   the nix-build. However, beacuse the layers are bit-for-bit
   reproducable, when these images are loaded in to Docker they will
   match existing layers and not be imported or uploaded twice.

Common Questions

 - Aren't Docker layers ordered?

   No. People who have used a Dockerfile before assume Docker's
   Layers are inherently ordered. However, this is not true -- Docker
   layers are content-addressable and are not explicitly layered until
   they are composed in to an Image.

 - What happens if I have more than maxLayers of store paths?

   The first (maxLayers-2) most "popular" paths will have their own
   individual layers, then layer #(maxLayers-1) will contain all the
   remaining "unpopular" paths, and finally layer #(maxLayers) will
   contain the Image configuration.
2018-09-26 17:54:14 -04:00
..
languages-frameworks doc/vim: remove some vim-plug redundancy 2018-09-20 08:20:11 +01:00
old reewide: Purge all uses stdenv.system and top-level system 2018-08-30 17:20:32 -04:00
.gitignore nixpkgs docs: syntax highlight 2018-03-26 21:44:24 -04:00
coding-conventions.xml doc: ran make format 2018-05-31 21:03:37 -04:00
configuration.xml Manual: Random indentation fixes 2018-09-03 17:13:46 +02:00
contributing.xml nixpkgs docs: format =) 2018-05-01 19:54:21 -04:00
cross-compilation.xml doc: Don't mention top-level {build, host, target}Platform 2018-09-23 13:25:44 -04:00
default.nix Merge pull request #43857 from volth/unused 2018-07-20 21:06:32 +02:00
functions.xml dockerTools.buildLayeredImage: init 2018-09-26 17:54:14 -04:00
introduction.chapter.md Fix invalid sentence in doc (#43228) 2018-07-08 23:46:34 +02:00
Makefile doc: Adds xml fixing script. (see previous and next commits) 2018-05-31 21:02:15 -04:00
manual.xml nixpkgs docs: format =) 2018-05-01 19:54:21 -04:00
meta.xml doc: ran make format 2018-05-31 21:03:37 -04:00
multiple-output.xml nixpkgs docs: give linked things IDs 2018-09-01 15:20:57 -04:00
overlays.xml nixpkgs docs: format =) 2018-05-01 19:54:21 -04:00
overrides.css doc: Fixes in-text callouts and screen callouts. 2018-04-07 15:38:12 -04:00
package-notes.xml ibus-engines.typing-booster: init at 2.1.1 2018-09-19 21:27:10 +02:00
platform-notes.xml nixpkgs docs: normalize 2018-08-27 19:54:41 -04:00
quick-start.xml doc: change git:// links to https:// (#44395) 2018-08-03 14:01:34 +01:00
release-notes.xml nixpkgs docs: give linked things IDs 2018-09-01 15:20:57 -04:00
reviewing-contributions.xml nixpkgs docs: give linked things IDs 2018-09-01 15:20:57 -04:00
shell.nix doc: Adds xml fixing script. (see previous and next commits) 2018-05-31 21:02:15 -04:00
shell.section.md docs: Build with a makefile 2018-03-25 19:52:07 -04:00
stdenv.xml doc/stdenv: libaries -> libraries (#47011) 2018-09-20 18:45:54 +01:00
style.css nixos docs: syntax highlight 2018-04-05 07:54:01 -04:00
submitting-changes.xml Add section IDs 2018-09-01 15:06:38 -04:00