Skip to content

Port mappings are exposed with a delay to the host #1424

@LouBen3010

Description

@LouBen3010

Description

We're migrating from Docker Desktop to Colima and are facing weird issues with Colima and Testcontainers for Java. Sometimes, tests are working instantly, sometimes, they aren't. It feels like debugging flaky test with the test infrastructure itself being flaky.

The tests are starting a PostgreSQL container and execute a simple database migration with Flyway. Although, the log messages were stating that the PostgreSQL was ready to accept connections (which is the event that triggers the test execution), the test execution failed due to network problems. It seemed that the containers were not responding on their specific database port. The key to solve the problem was to delay the test execution after spinning up the test containers.

Why? It seems that Colima isn't exposing the ports to the host system instantly. When I wait for additional 2 seconds after spinning up the container, the tests were almost always successful.

I know, that this behavior is pretty specific in the Testcontainers scenario, but maybe this comes from a bug in Colima since I can't reproduce this behavior in Docker Desktop or Podman.

Version

colima version 0.9.1
git commit: 0cbf719f5409ce04b9f0607b681c005d2ff7d94a

runtime: docker
arch: aarch64
client: v28.4.0
server: v28.4.0
limactl version 1.2.1
zsh: command not found: qemu-img

Operating System

  • macOS Intel <= 13 (Ventura)
  • macOS Intel >= 14 (Sonoma)
  • Apple Silicon <= 13 (Ventura)
  • Apple Silicon >= 14 (Sonoma)
  • Linux

Output of colima status

INFO[0000] colima is running using macOS Virtualization.Framework
INFO[0000] arch: aarch64
INFO[0000] runtime: docker
INFO[0000] mountType: virtiofs
INFO[0000] address: 192.168.64.7
INFO[0000] docker socket: unix:///Users/benediktloup/.colima/default/docker.sock
INFO[0000] containerd socket: unix:///Users/benediktloup/.colima/default/containerd.sock

Reproduction Steps

  1. Create an sample project with Testcontainers for Java and Flyway
  2. Add a PostgreSQL container
  3. Create a database migration file adding a table
  4. Execute the (empty) test with an simple assertion

Expected behaviour

Before starting the actual test, the PostgreSQL container spins up and Flyway executes the migration.

Additional context

You can also see the behavior in the "ryuk" utility container as well when the Testcontainers framework is starting. Usually, ryuk instantly responds but when using Colima, the first 5-10 network connection attempts are failing.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions