Skip to content

Can nix-ld be used in docker image created with nix2container? #60

@nxy7

Description

@nxy7

Hi, I'm trying to create minimal docker image, that can run binaries. I've created repo @ https://github.com/nxy7/tiny and published this image to docker hub (in case anyone wants to test it) as nxyt/tiny:latest. Anyway - it doesn't work and any binary I run results in bash: ./main: cannot execute: required file not found.
As far as I understand binaries expect linker at specific location, so even if ldd my-binary shows that all dependencies are present it still tries to call linker at /lib64/xxx and because there's none, that's why my binaries are failing.

If I got that right, that's the problem that nix-ld is trying to solve, but I cannot really get that to work with nix2container.
What I've tried was adding nix_ld to copyToRoot and adding 'lib' and 'lib64' to 'pathsToLink' and I've also added NIX_LD env variable, but that still doesn't work.

Can nix-ld be used to fix that error, or is it made only for NixOS? Any guidance toward getting that to work would be great :-)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions