Skip to content

Nodejs inside docker image using dockerTools.buildImage cannot start in NixOS (but starts in Ubuntu) #170279

@CMCDragonkai

Description

@CMCDragonkai

Describe the bug

When using dockerTools.buildImage with just nodejs as the only contents, it is not possible to run the /bin/node inside the container in NixOS. But it does work in Ubuntu 22.04.

Steps To Reproduce

Steps to reproduce the behavior:

    dockerTools.buildImage {
      name = "nodejs";
      contents = [ nodejs ];
      keepContentsDirlinks = true;
      extraCommands = ''
        mkdir -m 1777 tmp
      '';
    };

Build that with nix-build or nix repl, and then load it and run:

loaded="$(docker load --input "$(nix-build ./default.nix)")"
image="$(cut -d' ' -f3 <<< "$loaded")"
docker run -it "$image" /bin/node

Results in:

/bin/node[1]: ../src/node_platform.cc:61:std::unique_ptr<long unsigned int> node::WorkerThreadsTaskRunner::DelayedTaskScheduler::Start(): Assertion `(0) == (uv_thread_create(t.get(), start_thread, this))' failed.
 1: 0xa64dd8 node::Abort() [/bin/node]
 2: 0xa64e67  [/bin/node]
 3: 0xae5f75 node::WorkerThreadsTaskRunner::WorkerThreadsTaskRunner(int) [/bin/node]
 4: 0xae60a2 node::NodePlatform::NodePlatform(int, v8::TracingController*) [/bin/node]
 5: 0xa24d2f node::V8Platform::Initialize(int) [/bin/node]
 6: 0xa2304b node::InitializeOncePerProcess(int, char**, node::InitializationSettingsFlags, node::ProcessFlags::Flags) [/bin/node]
 7: 0xa231d9 node::InitializeOncePerProcess(int, char**) [/bin/node]
 8: 0xa23238 node::Start(int, char**) [/bin/node]
 9: 0x7f1c2eaf91d7  [/nix/store/ayrsyv7npr0lcbann4k9lxr19x813f0z-glibc-2.34-115/lib/libc.so.6]
10: 0x7f1c2eaf9297 __libc_start_main [/nix/store/ayrsyv7npr0lcbann4k9lxr19x813f0z-glibc-2.34-115/lib/libc.so.6]
11: 0x989ce1 _start [/bin/node]

Expected behavior

It should just run the node repl.

Additional context

Add any other context about the problem here.

Metadata

I'm pinned on a5774e7 as the nixpkgs commit revision.

Running on NixOS

»» ~
 ♖ nix-shell -p nix-info --run "nix-info -m"                                                      pts/3 1:41:14
 - system: `"x86_64-linux"`
 - host os: `Linux 5.10.106, Matrix Vostro 5402 1, noversion`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.3.16`
 - nixpkgs: `/etc/nixpkgs`

And my NixOS nixpkgs revision is d89f18a

Metadata

Metadata

Assignees

No one assigned

    Labels

    0.kind: bugSomething is broken2.status: stalehttps://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md6.topic: docker toolsOpen-source software for deploying and running of containerized applications6.topic: nixosIssues or PRs affecting NixOS modules, or package usability issues specific to NixOS6.topic: nodejsNode.js is a free, open-source, cross-platform JavaScript runtime environment

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions