Docker image allowing non-nix applications

I want to create a docker image which will need to allow the user to add non-nix dynamically linked binaries. The binaries (I know what they will be) won’t have any fancy dependencies, just glibc (libc, libm, etc.). Is it possible to expose nixpkgs glibc in the image somehow? Is buildFHSUserEnv way to go?

While not exactly what you’re after, there are some tools which will run non-nix dynamically linked binaries, although I haven’t tried them:


nix-ld indeed worked. My containers don’t have systemd, so I created the symlink in the runAsRoot section:

ln -s /libexec/nix-ld /lib64/$(basename  $(< ${}/nix-support/dynamic-linker))

then in Env.config section:

"NIX_LD_LIBRARY_PATH=${lib.makeLibraryPath [ openssl ...]}"
''NIX_LD=${lib.fileContents "${}/nix-support/dynamic-linker"}''
Hosted by Flying Circus.