testcontainers / testcontainers-node

Testcontainers is a NodeJS library that supports tests, providing lightweight, throwaway instances of common databases, Selenium web browsers, or anything else that can run in a Docker container.
https://testcontainers.com
MIT License
1.82k stars 176 forks source link

Error: Failed to connect to Reaper with Testcontainers version v10.9.0 #772

Closed westmes closed 2 weeks ago

westmes commented 1 month ago

I am seeing same issue as https://github.com/testcontainers/testcontainers-node/issues/570 where it throws an error "Error: Failed to connect to Reaper" when trying to bring up the containers.

I ran into the issue when using node version 18.18.2 but works fine if I try one of the following:

Expected Behaviour run test

Actual Behaviour Error: Failed to connect to Reaper

Testcontainer Logs

  testcontainers [INFO] Starting DockerCompose environment "testcontainers-b7da8cbf864e"... +0ms
  testcontainers [DEBUG] Testing container runtime strategy "TestcontainersHostStrategy"... +0ms
  testcontainers [DEBUG] Testing container runtime strategy "ConfigurationStrategy"... +0ms
  testcontainers [DEBUG] Testing container runtime strategy "UnixSocketStrategy"... +1ms
  testcontainers [DEBUG] Container runtime strategy "UnixSocketStrategy" works +943ms
  testcontainers [DEBUG] Acquiring lock file "/tmp/testcontainers-node.lock"... +2ms
  testcontainers [DEBUG] Acquired lock file "/tmp/testcontainers-node.lock" +2ms
  testcontainers [DEBUG] Listing containers... +0ms
  testcontainers [DEBUG] Listed containers +2ms
  testcontainers [DEBUG] Creating new Reaper for session "65f9c64f9f90" with socket path "/var/run/docker.sock"... +0ms
  testcontainers [DEBUG] Checking if image exists "testcontainers/ryuk:0.5.1"... +1ms
  testcontainers [DEBUG] Checked if image exists "testcontainers/ryuk:0.5.1" +2ms
  testcontainers [DEBUG] Image "testcontainers/ryuk:0.5.1" already exists +0ms
  testcontainers [DEBUG] Creating container for image "testcontainers/ryuk:0.5.1"... +0ms
  testcontainers [DEBUG] [733fa3e4b54f] Created container for image "testcontainers/ryuk:0.5.1" +33ms
  testcontainers [INFO] [733fa3e4b54f] Starting container for image "testcontainers/ryuk:0.5.1"... +0ms
  testcontainers [DEBUG] [733fa3e4b54f] Starting container... +0ms
  testcontainers [DEBUG] [733fa3e4b54f] Started container +240ms
  testcontainers [INFO] [733fa3e4b54f] Started container for image "testcontainers/ryuk:0.5.1" +0ms
  testcontainers [DEBUG] [733fa3e4b54f] Inspecting container... +0ms
  testcontainers [DEBUG] [733fa3e4b54f] Inspected container +2ms
  testcontainers [DEBUG] [733fa3e4b54f] Fetching container logs... +0ms
  testcontainers [DEBUG] [733fa3e4b54f] Demuxing stream... +1ms
  testcontainers [DEBUG] [733fa3e4b54f] Demuxed stream +0ms
  testcontainers [DEBUG] [733fa3e4b54f] Fetched container logs +0ms
  testcontainers [DEBUG] [733fa3e4b54f] Waiting for container to be ready... +1ms
  testcontainers [DEBUG] [733fa3e4b54f] Waiting for log message "/.+ Started!/"... +0ms
  testcontainers [DEBUG] [733fa3e4b54f] Fetching container logs... +0ms
  testcontainers:containers [733fa3e4b54f] 2024/06/04 14:27:45 Pinging Docker... +0ms
  testcontainers:containers [733fa3e4b54f] 2024/06/04 14:27:45 Docker daemon is available! +0ms
  testcontainers:containers [733fa3e4b54f] 2024/06/04 14:27:45 Starting on port 8080... +0ms
  testcontainers:containers [733fa3e4b54f] 2024/06/04 14:27:45 Started! +0ms
  testcontainers [DEBUG] [733fa3e4b54f] Demuxing stream... +2ms
  testcontainers [DEBUG] [733fa3e4b54f] Demuxed stream +0ms
  testcontainers [DEBUG] [733fa3e4b54f] Fetched container logs +0ms
  testcontainers [DEBUG] [733fa3e4b54f] Log wait strategy complete +2ms
  testcontainers [INFO] [733fa3e4b54f] Container is ready +1ms
  testcontainers [DEBUG] [733fa3e4b54f] Connecting to Reaper (attempt 1) on "localhost:49191"... +1ms
  testcontainers [ERROR] Reaper 733fa3e4b54fb19ddfad67baf468f8c9d88487d80651ff7d0d07eeb66d0d1aea socket error: Error: connect ECONNREFUSED ::1:49191 +2ms
  testcontainers [ERROR] [733fa3e4b54f] Connection to Reaper closed with error +0ms
  testcontainers [DEBUG] [733fa3e4b54f] Connecting to Reaper (attempt 2) on "localhost:49191"... +1s
  testcontainers [ERROR] Reaper 733fa3e4b54fb19ddfad67baf468f8c9d88487d80651ff7d0d07eeb66d0d1aea socket error: Error: connect ECONNREFUSED ::1:49191 +1ms
  testcontainers [ERROR] [733fa3e4b54f] Connection to Reaper closed with error +0ms
  testcontainers [DEBUG] [733fa3e4b54f] Connecting to Reaper (attempt 3) on "localhost:49191"... +1s
  testcontainers [ERROR] Reaper 733fa3e4b54fb19ddfad67baf468f8c9d88487d80651ff7d0d07eeb66d0d1aea socket error: Error: connect ECONNREFUSED ::1:49191 +0ms
  testcontainers [ERROR] [733fa3e4b54f] Connection to Reaper closed with error +0ms
  testcontainers [DEBUG] [733fa3e4b54f] Connecting to Reaper (attempt 4) on "localhost:49191"... +1s
  testcontainers [ERROR] Reaper 733fa3e4b54fb19ddfad67baf468f8c9d88487d80651ff7d0d07eeb66d0d1aea socket error: Error: connect ECONNREFUSED ::1:49191 +1ms
  testcontainers [ERROR] [733fa3e4b54f] Connection to Reaper closed with error +0ms
  testcontainers [DEBUG] [733fa3e4b54f] Connecting to Reaper (attempt 5) on "localhost:49191"... +1s
  testcontainers [ERROR] Reaper 733fa3e4b54fb19ddfad67baf468f8c9d88487d80651ff7d0d07eeb66d0d1aea socket error: Error: connect ECONNREFUSED ::1:49191 +0ms
  testcontainers [ERROR] [733fa3e4b54f] Connection to Reaper closed with error +1ms
  testcontainers [ERROR] [733fa3e4b54f] Failed to connect to Reaper +0ms
  testcontainers [DEBUG] Releasing lock file "/tmp/testcontainers-node.lock"... +0ms
  testcontainers [DEBUG] Released lock file "/tmp/testcontainers-node.lock" +0ms

Steps to Reproduce

  1. In this environment...
  2. With this config...
  3. Run '...'
  4. See error...

Environment Information

cristianrgreco commented 1 month ago

@westmes I assume that Testcontainers isn't able to connect to Ryuk on host 127.0.0.1 which you have overridden in the environment