testcontainers-node icon indicating copy to clipboard operation
testcontainers-node copied to clipboard

`An error occurred listing credentials` with `docker-credential-gcr`

Open glebbash opened this issue 1 year ago • 0 comments

Expected Behaviour Should work fine :)

Actual Behaviour Having docker-credential-gcr installed makes it not possible to start testcontainers.

Problem is that running docker-credential-gcr list command returns exit code 1, which triggers an error here: https://github.com/testcontainers/testcontainers-node/blob/0488293b7b9cb5883a1f0c46fa4df74c53d465e6/packages/testcontainers/src/container-runtime/auth/credential-provider.ts#L46

This is caused by list command being not implemented:

Usage: docker-credential-gcr <flags> <subcommand> <subcommand args>
...
Subcommands for Docker credential store API:
        erase            (UNIMPLEMENTED) erase any stored credentials for the server specified via stdin
        get              for the server specified via stdin, return the stored credentials via stdout
        list             (UNIMPLEMENTED) list all stored credentials
...

P.S: not really sure what commands are required to be implemented by docker credential helpers spec (if there is one) so it might be an issue for docker-credential-gcr repo.

Testcontainer Logs

Error: An error occurred listing credentials
    at /workspace/***/node_modules/testcontainers/build/container-runtime/auth/credential-provider.js:32:35
    at ChildProcess.exithandler (node:child_process:430:5)
    at ChildProcess.emit (node:events:518:28)
    at maybeClose (node:internal/child_process:1105:16)
    at ChildProcess._handle.onexit (node:internal/child_process:305:5)

Steps to Reproduce

  1. Install docker-credential-gcr
  2. Run the following (or any other container):
import { GenericContainer, Wait } from "testcontainers";

const spannerEmulator = await new GenericContainer(
  "gcr.io/cloud-spanner-emulator/emulator"
)
  .withExposedPorts(9010)
  .withWaitStrategy(Wait.forLogMessage("gRPC server listening at"))
  .start();

Environment Information

  • Operating System: Ubuntu 22.04
  • Docker Version: 25.0.3
  • Node version: v20.11.1
  • Testcontainers version: 10.7.2

glebbash avatar Mar 27 '24 13:03 glebbash