mirror of
https://github.com/NixOS/nixpkgs.git
synced 2026-03-08 04:04:06 +01:00
dockerTools: Replace bashInteractive with bash
bash has been interactive by default since this PR [1] was merged. This commit simplifies dockerTools given that there is now no distinction between bash and bashInteractive. * [1] https://github.com/NixOS/nixpkgs/pull/379368 Co-authored-by: commiterate <111539270+commiterate@users.noreply.github.com> Signed-off-by: Joel Holdsworth <joel@airwebreathe.org.uk>
This commit is contained in:
parent
0274b44151
commit
a003bc7c60
3 changed files with 19 additions and 19 deletions
|
|
@ -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}
|
||||
|
|
@ -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_)
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
bashInteractive,
|
||||
bash,
|
||||
buildPackages,
|
||||
cacert,
|
||||
callPackage,
|
||||
|
|
@ -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
|
||||
|
|
@ -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,
|
||||
}:
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@ rec {
|
|||
tag = "latest";
|
||||
copyToRoot = pkgs.buildEnv {
|
||||
name = "image-root";
|
||||
paths = [ pkgs.bashInteractive ];
|
||||
paths = [ pkgs.bash ];
|
||||
pathsToLink = [ "/bin" ];
|
||||
};
|
||||
};
|
||||
|
|
@ -541,7 +541,7 @@ 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 {
|
||||
|
|
@ -549,20 +549,20 @@ rec {
|
|||
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
|
||||
|
|
@ -570,7 +570,7 @@ rec {
|
|||
name = "bash-layered-uncompressed";
|
||||
tag = "latest";
|
||||
compressor = "none";
|
||||
contents = pkgs.bashInteractive;
|
||||
contents = pkgs.bash;
|
||||
};
|
||||
|
||||
# buildLayeredImage with zstd compression
|
||||
|
|
@ -578,13 +578,13 @@ rec {
|
|||
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
|
||||
|
|
@ -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
|
||||
];
|
||||
};
|
||||
|
|
@ -841,7 +841,7 @@ rec {
|
|||
name = "layered-image-with-path";
|
||||
tag = "latest";
|
||||
contents = [
|
||||
pkgs.bashInteractive
|
||||
pkgs.bash
|
||||
./test-dummy
|
||||
];
|
||||
};
|
||||
|
|
@ -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
|
||||
];
|
||||
};
|
||||
|
|
@ -862,7 +862,7 @@ rec {
|
|||
tag = "latest";
|
||||
architecture = "arm64";
|
||||
contents = [
|
||||
pkgs.bashInteractive
|
||||
pkgs.bash
|
||||
./test-dummy
|
||||
];
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue