Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions doc/build-helpers/images/dockertools.section.md
Original file line number Diff line number Diff line change
Expand Up @@ -1186,7 +1186,7 @@ This is currently implemented by linking to the `env` binary from the `coreutils

### binSh {#sssec-pkgs-dockerTools-helpers-binSh}

This provides a `/bin/sh` link to the `bash` binary from the `bashInteractive` package.
This provides a `/bin/sh` link to the `bash` binary from the `bash` package.
Because of this, it supports cases such as running a command interactively in a container (for example by running `docker container run -it <image_name>`).

### caCertificates {#sssec-pkgs-dockerTools-helpers-caCertificates}
Expand Down Expand Up @@ -1490,7 +1490,7 @@ The environment in the image doesn't match `nix-shell` or `nix-build` exactly, a
This shell is started when running the image.
This can be seen as an equivalent of the `NIX_BUILD_SHELL` [environment variable](https://nixos.org/manual/nix/stable/command-ref/nix-shell.html#environment-variables) for {manpage}`nix-shell(1)`.

_Default value:_ the `bash` binary from the `bashInteractive` package.
_Default value:_ the `bash` binary from the `bash` package.

`command` (String or Null; _optional_)

Expand Down
10 changes: 5 additions & 5 deletions pkgs/build-support/docker/default.nix
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
bashInteractive,
bash,
buildPackages,
cacert,
callPackage,
Expand Down Expand Up @@ -959,11 +959,11 @@ rec {
ln -s ${coreutils}/bin/env $out/usr/bin
'';

# This provides /bin/sh, pointing to bashInteractive.
# The use of bashInteractive here is intentional to support cases like `docker run -it <image_name>`, so keep these use cases in mind if making any changes to how this works.
# This provides /bin/sh, pointing to bash (interactive).
# The use of bash (interactive) here is intentional to support cases like `docker run -it <image_name>`, so keep these use cases in mind if making any changes to how this works.
binSh = runCommand "bin-sh" { } ''
mkdir -p $out/bin
ln -s ${bashInteractive}/bin/bash $out/bin/sh
ln -s ${bash}/bin/bash $out/bin/sh
'';

# This provides the ca bundle in common locations
Expand Down Expand Up @@ -1256,7 +1256,7 @@ rec {
#
# https://github.com/NixOS/nix/issues/6379
homeDirectory ? "/build",
shell ? bashInteractive + "/bin/bash",
shell ? bash + "/bin/bash",
command ? null,
run ? null,
}:
Expand Down
24 changes: 12 additions & 12 deletions pkgs/build-support/docker/examples.nix
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ rec {
tag = "latest";
copyToRoot = pkgs.buildEnv {
name = "image-root";
paths = [ pkgs.bashInteractive ];
paths = [ pkgs.bash ];
pathsToLink = [ "/bin" ];
};
};
Expand Down Expand Up @@ -541,50 +541,50 @@ rec {
tag = "latest";
compressor = "none";
# Not recommended. Use `buildEnv` between copy and packages to avoid file duplication.
copyToRoot = pkgs.bashInteractive;
copyToRoot = pkgs.bash;
};

bashZstdCompressed = pkgs.dockerTools.buildImage {
name = "bash-zstd";
tag = "latest";
compressor = "zstd";
# Not recommended. Use `buildEnv` between copy and packages to avoid file duplication.
copyToRoot = pkgs.bashInteractive;
copyToRoot = pkgs.bash;
};

# buildImage without explicit tag
bashNoTag = pkgs.dockerTools.buildImage {
name = "bash-no-tag";
# Not recommended. Use `buildEnv` between copy and packages to avoid file duplication.
copyToRoot = pkgs.bashInteractive;
copyToRoot = pkgs.bash;
};

# buildLayeredImage without explicit tag
bashNoTagLayered = pkgs.dockerTools.buildLayeredImage {
name = "bash-no-tag-layered";
contents = pkgs.bashInteractive;
contents = pkgs.bash;
};

# buildLayeredImage without compression
bashLayeredUncompressed = pkgs.dockerTools.buildLayeredImage {
name = "bash-layered-uncompressed";
tag = "latest";
compressor = "none";
contents = pkgs.bashInteractive;
contents = pkgs.bash;
};

# buildLayeredImage with zstd compression
bashLayeredZstdCompressed = pkgs.dockerTools.buildLayeredImage {
name = "bash-layered-zstd";
tag = "latest";
compressor = "zstd";
contents = pkgs.bashInteractive;
contents = pkgs.bash;
};

# streamLayeredImage without explicit tag
bashNoTagStreamLayered = pkgs.dockerTools.streamLayeredImage {
name = "bash-no-tag-stream-layered";
contents = pkgs.bashInteractive;
contents = pkgs.bash;
};

# buildLayeredImage with non-root user
Expand Down Expand Up @@ -832,7 +832,7 @@ rec {
tag = "latest";
# Not recommended. Use `buildEnv` between copy and packages to avoid file duplication.
copyToRoot = [
pkgs.bashInteractive
pkgs.bash
./test-dummy
];
};
Expand All @@ -841,7 +841,7 @@ rec {
name = "layered-image-with-path";
tag = "latest";
contents = [
pkgs.bashInteractive
pkgs.bash
./test-dummy
];
};
Expand All @@ -852,7 +852,7 @@ rec {
architecture = "arm64";
# Not recommended. Use `buildEnv` between copy and packages to avoid file duplication.
copyToRoot = [
pkgs.bashInteractive
pkgs.bash
./test-dummy
];
};
Expand All @@ -862,7 +862,7 @@ rec {
tag = "latest";
architecture = "arm64";
contents = [
pkgs.bashInteractive
pkgs.bash
./test-dummy
];
};
Expand Down
Loading