···62626363- `config` is used to specify the configuration of the containers that will be started off the built image in Docker. The available options are listed in the [Docker Image Specification v1.2.0](https://github.com/moby/moby/blob/master/image/spec/v1.2.md#image-json-field-descriptions).
64646565+- `architecture` is _optional_ and used to specify the image architecture, this is useful for multi-architecture builds that don't need cross compiling. If not specified it will default to `hostPlatform`.
6666+6567- `diskSize` is used to specify the disk size of the VM used to build the image in megabytes. By default it's 1024 MiB.
66686769- `buildVMMemorySize` is used to specify the memory size of the VM to build the image in megabytes. By default it's 512 MiB.
···140142 *Default:* `[]`
141143142144`config` _optional_
145145+146146+`architecture` is _optional_ and used to specify the image architecture, this is useful for multi-architecture builds that don't need cross compiling. If not specified it will default to `hostPlatform`.
143147144148: Run-time configuration of the container. A full list of the options are available at in the [Docker Image Specification v1.2.0](https://github.com/moby/moby/blob/master/image/spec/v1.2.md#image-json-field-descriptions).
145149
···7474 # Reference: https://github.com/opencontainers/image-spec/blob/master/config.md#properties
7575 # For the mapping from Nixpkgs system parameters to GOARCH, we can reuse the
7676 # mapping from the go package.
7777- defaultArch = go.GOARCH;
7777+ defaultArchitecture = go.GOARCH;
78787979in
8080rec {
···101101 , imageDigest
102102 , sha256
103103 , os ? "linux"
104104- , arch ? defaultArch
105105-104104+ , # Image architecture, defaults to the architecture of the `hostPlatform` when unset
105105+ arch ? defaultArchitecture
106106 # This is used to set name to the pulled image
107107 , finalImageName ? imageName
108108 # This used to set a tag to the pulled image
···514514 keepContentsDirlinks ? false
515515 , # Docker config; e.g. what command to run on the container.
516516 config ? null
517517+ , # Image architecture, defaults to the architecture of the `hostPlatform` when unset
518518+ architecture ? defaultArchitecture
517519 , # Optional bash script to run on the files prior to fixturizing the layer.
518520 extraCommands ? ""
519521 , uid ? 0
···546548 baseJson =
547549 let
548550 pure = writeText "${baseName}-config.json" (builtins.toJSON {
549549- inherit created config;
550550- architecture = defaultArch;
551551+ inherit created config architecture;
551552 preferLocalBuild = true;
552553 os = "linux";
553554 });
···838839 contents ? [ ]
839840 , # Docker config; e.g. what command to run on the container.
840841 config ? { }
842842+ , # Image architecture, defaults to the architecture of the `hostPlatform` when unset
843843+ architecture ? defaultArchitecture
841844 , # Time of creation of the image. Passing "now" will make the
842845 # created date be the time of building.
843846 created ? "1970-01-01T00:00:01Z"
···869872870873 streamScript = writePython3 "stream" { } ./stream_layered_image.py;
871874 baseJson = writeText "${baseName}-base.json" (builtins.toJSON {
872872- inherit config;
873873- architecture = defaultArch;
875875+ inherit config architecture;
874876 os = "linux";
875877 });
876878
+16-1
pkgs/build-support/docker/examples.nix
···9292 ];
93939494 extraCommands = ''
9595- mkdir -p tmp
9595+ mkdir -p tmp/nginx_client_body
96969797 # nginx still tries to read this directory even if error_log
9898 # directive is specifying another file :/
···697697 layered-image-with-path = pkgs.dockerTools.streamLayeredImage {
698698 name = "layered-image-with-path";
699699 tag = "latest";
700700+ contents = [ pkgs.bashInteractive ./test-dummy ];
701701+ };
702702+703703+ build-image-with-architecture = buildImage {
704704+ name = "build-image-with-architecture";
705705+ tag = "latest";
706706+ architecture = "arm64";
707707+ # Not recommended. Use `buildEnv` between copy and packages to avoid file duplication.
708708+ copyToRoot = [ pkgs.bashInteractive ./test-dummy ];
709709+ };
710710+711711+ layered-image-with-architecture = pkgs.dockerTools.streamLayeredImage {
712712+ name = "layered-image-with-architecture";
713713+ tag = "latest";
714714+ architecture = "arm64";
700715 contents = [ pkgs.bashInteractive ./test-dummy ];
701716 };
702717