You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Create a flake like so, note the commit hash is from before the change and works fine.
{
description = "A very basic flake";
inputs = {
nixpkgs.url =
"github:nixos/nixpkgs?ref=a3836576dd7d7e606f393434d39661ff096859f9";
};
outputs = { self, nixpkgs }:
let
pkgs = nixpkgs.legacyPackages.x86_64-linux;
customPostgresql = pkgs.postgresql.withPackages (nixPgExtensions:
[
# I have some extensions here.
]);
dockerOptions = {
name = "test-docker";
tag = "latest";
contents = [ pkgs.bash pkgs.coreutils customPostgresql ];
config = {
Entrypoint = [ "/bin/bash" ];
WorkingDir = "/";
};
};
dockerImageGzip = pkgs.dockerTools.buildLayeredImage dockerOptions;
in {
packages.x86_64-linux.docker = dockerImageGzip;
packages.x86_64-linux.postgres = customPostgresql;
};
}
It can be used like so and works fine.
nix build .#dockerdocker load < resultdocker run -it test-docker:latestpsql --version
Changing the nixpkgs url to github:nixos/nixpkgs?ref=5547322a0c01dd30a7e0111adc1f02bafbbd6ebc and running the same commands as above results in bash: psql: command not found
Expected behavior
That the contents of postgresql derivation's bin directory be symlinked into /bin like it is for other packages.
Additional context
Looks like dockerTools does not support derivations where the bin directory is a symlink.
This only happens when using pkgs.postgresql.withPackages using just pkgs.postgresql works fine.
Is this a duplicate of #102962? There's some discussion about contents not being the right tool for the job in there. I didn't go through that in detail, but maybe you want to see whether there are alternative ways to write your flake?
Describe the bug
The command line tools such as
psql
are not being symlinked into /bin inside Docker images created withpkgs.dockerTools.buildLayeredImage
The issue was introduced here 5547322#diff-3a40021ad7a436b9b71a4552b7b0ad4191dc190654bcfd383bf5fac2248e2ca9L292 #294504
Steps To Reproduce
Create a flake like so, note the commit hash is from before the change and works fine.
It can be used like so and works fine.
Changing the nixpkgs url to
github:nixos/nixpkgs?ref=5547322a0c01dd30a7e0111adc1f02bafbbd6ebc
and running the same commands as above results inbash: psql: command not found
Expected behavior
That the contents of postgresql derivation's
bin
directory be symlinked into/bin
like it is for other packages.Additional context
Looks like dockerTools does not support derivations where the
bin
directory is a symlink.This only happens when using
pkgs.postgresql.withPackages
using justpkgs.postgresql
works fine.Notify maintainers
@wolfgangwalther
I'm not sure who maintains dockerTools.
Metadata
Please run
nix-shell -p nix-info --run "nix-info -m"
and paste the result.The text was updated successfully, but these errors were encountered: