Skip to content

Error: No host port found for host IP #818

@theogravity

Description

@theogravity

Expected Behaviour
Container should start up.

Actual Behaviour


⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Unhandled Error ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯
Error: No host port found for host IP
 ❯ resolveHostPortBinding ../../node_modules/.pnpm/[email protected]/node_modules/testcontainers/src/utils/bound-ports.ts:74:9
 ❯ ../../node_modules/.pnpm/[email protected]/node_modules/testcontainers/src/utils/bound-ports.ts:55:46
 ❯ Function.fromInspectResult ../../node_modules/.pnpm/[email protected]/node_modules/testcontainers/src/utils/bound-ports.ts:54:41
 ❯ GenericContainer.startContainer ../../node_modules/.pnpm/[email protected]/node_modules/testcontainers/src/generic-container/generic-container.ts:177:35
 ❯ processTicksAndRejections node:internal/process/task_queues:95:5
 ❯ createNewReaper ../../node_modules/.pnpm/[email protected]/node_modules/testcontainers/src/reaper/reaper.ts:84:28
 ❯ ../../node_modules/.pnpm/[email protected]/node_modules/testcontainers/src/reaper/reaper.ts:38:14
 ❯ withFileLock ../../node_modules/.pnpm/[email protected]/node_modules/testcontainers/src/common/file-lock.ts:14:12
 ❯ getReaper ../../node_modules/.pnpm/[email protected]/node_modules/testcontainers/src/reaper/reaper.ts:29:12

Testcontainer Logs

  testcontainers [TRACE] Container runtime info:
  testcontainers {
  testcontainers   "node": {
  testcontainers     "version": "v20.16.0",
  testcontainers     "architecture": "arm64",
  testcontainers     "platform": "darwin"
  testcontainers   },
  testcontainers   "containerRuntime": {
  testcontainers     "host": "localhost",
  testcontainers     "hostIps": [
  testcontainers       {
  testcontainers         "address": "::1",
  testcontainers         "family": 6
  testcontainers       }
  testcontainers     ],
  testcontainers     "remoteSocketPath": "/var/run/docker.sock",
  testcontainers     "indexServerAddress": "https://index.docker.io/v1/",
  testcontainers     "serverVersion": "27.1.1",
  testcontainers     "operatingSystem": "Docker Desktop",
  testcontainers     "operatingSystemType": "linux",
  testcontainers     "architecture": "aarch64",
  testcontainers     "cpus": 12,
  testcontainers     "memory": 8219254784,
  testcontainers     "runtimes": [
  testcontainers       "io.containerd.runc.v2",
  testcontainers       "runc"
  testcontainers     ]
  testcontainers   },
  testcontainers   "compose": {
  testcontainers     "version": "2.29.1-desktop.1",
  testcontainers     "compatability": "v2"
  testcontainers   }
  testcontainers }

Steps to Reproduce

  const postgresContainer = await new PostgreSqlContainer().start();

  process.env.DB_PORT = postgresContainer.getPort().toString();
  process.env.DB_USER = postgresContainer.getUsername();
  process.env.DB_PASS = postgresContainer.getPassword();
  process.env.DB_NAME = postgresContainer.getDatabase();

Environment Information

  • Operating System: MacOS 14.5
  • Docker Version: 4.33.0 (160616)
  • Node version: 20.16.0
  • Testcontainers version: "@testcontainers/postgresql": "10.11.0"

This is a co-worker's environment. I've checked their MacOS network settings - nothing seems out of the ordinary. They have an IPv4 setup with IPv6 set to automatic (my own working environment is more extensive, with custom IPv6). Their docker configuration settings are the default for a docker desktop installation. We also tried stopping all existing containers before re-running without any luck.

One thing I noticed between my own working environment and theirs, is the following:

  testcontainers   "containerRuntime": {
  testcontainers     "host": "localhost",
  testcontainers     "hostIps": [
  testcontainers       {
  testcontainers         "address": "::1",
  testcontainers         "family": 6
  testcontainers       },
  testcontainers       {
  testcontainers         "address": "127.0.0.1",
  testcontainers         "family": 4
  testcontainers       }
  testcontainers     ],

Mine has an IPv4 recognized while theirs do not:

  testcontainers   "containerRuntime": {
  testcontainers     "host": "localhost",
  testcontainers     "hostIps": [
  testcontainers       {
  testcontainers         "address": "::1",
  testcontainers         "family": 6
  testcontainers       }
  testcontainers     ],

Metadata

Metadata

Assignees

No one assigned

    Labels

    triageInvestigation required

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions