arch icon indicating copy to clipboard operation
arch copied to clipboard

`arch` doesn't work on distroless images (since there is no shell)

Open akx opened this issue 5 months ago • 0 comments

Trying to run software (serve) that transitively requires arch on gcr.io/distroless/nodejs24-debian12 fails with an ENOENT error since there is no way to run /bin/sh -c "getconf LONG_BIT" (as distroless images don't have shells):

node:internal/child_process:1120
    result.error = new ErrnoException(result.error, 'spawnSync ' + options.file);
                   ^

<ref *1> Error: spawnSync /bin/sh ENOENT
    at Object.spawnSync (node:internal/child_process:1120:20)
    at spawnSync (node:child_process:878:24)
    at Object.execSync (node:child_process:959:15)
    at arch (/.../node_modules/arch/index.js:52:21)
    at file:///.../node_modules/clipboardy/lib/windows.js:8:22
    at ModuleJob.run (node:internal/modules/esm/module_job:365:25)
    at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:665:26)
    at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:99:5) {
  errno: -2,
  code: 'ENOENT',
  syscall: 'spawnSync /bin/sh',
  path: '/bin/sh',
  spawnargs: [ '-c', 'getconf LONG_BIT' ],
  error: [Circular *1],
  status: null,
  signal: null,
  output: null,
  pid: 0,
  stdout: undefined,
  stderr: undefined
}

I know this might be a bit of a corner case, but just something that just happened :)

akx avatar Jul 02 '25 12:07 akx