Skip to content

[Bug]: ServiceBusContainer does not start and throws Timeout exception on Windows #1466

Closed
@joeymedina

Description

@joeymedina

Testcontainers version

4.6

Using the latest Testcontainers version?

Yes

Host OS

Windows

Host arch

x64

.NET version

8.0

Docker version

Client:
 Version:           28.2.2
 API version:       1.50
 Go version:        go1.24.3
 Git commit:        e6534b4
 Built:             Fri May 30 12:07:16 2025
 OS/Arch:           windows/amd64
 Context:           desktop-linux

Server: Docker Desktop 4.42.0 (195023)
 Engine:
  Version:          28.2.2
  API version:      1.50 (minimum version 1.24)
  Go version:       go1.24.3
  Git commit:       45873be
  Built:            Fri May 30 12:07:26 2025
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.7.27
  GitCommit:        05044ec0a9a75232cad458027ca83437aae3f4da
 runc:
  Version:          1.2.5
  GitCommit:        v1.2.5-0-g59923ef
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

Docker info

Client:
 Version:    28.2.2
 Context:    desktop-linux
 Debug Mode: false
 Plugins:
  ai: Docker AI Agent - Ask Gordon (Docker Inc.)
    Version:  v1.4.0
    Path:     C:\Program Files\Docker\cli-plugins\docker-ai.exe
  buildx: Docker Buildx (Docker Inc.)
    Version:  v0.24.0-desktop.2
    Path:     C:\Program Files\Docker\cli-plugins\docker-buildx.exe
  cloud: Docker Cloud (Docker Inc.)
    Version:  v0.3.9
    Path:     C:\Program Files\Docker\cli-plugins\docker-cloud.exe
  compose: Docker Compose (Docker Inc.)
    Version:  v2.36.2-desktop.1
    Path:     C:\Program Files\Docker\cli-plugins\docker-compose.exe
  debug: Get a shell into any image or container (Docker Inc.)
    Version:  0.0.41
    Path:     C:\Program Files\Docker\cli-plugins\docker-debug.exe
  desktop: Docker Desktop commands (Docker Inc.)
    Version:  v0.1.9
    Path:     C:\Program Files\Docker\cli-plugins\docker-desktop.exe
  extension: Manages Docker extensions (Docker Inc.)
    Version:  v0.2.29
    Path:     C:\Program Files\Docker\cli-plugins\docker-extension.exe
  init: Creates Docker-related starter files for your project (Docker Inc.)
    Version:  v1.4.0
    Path:     C:\Program Files\Docker\cli-plugins\docker-init.exe
  mcp: Docker MCP Plugin (Docker Inc.)
    Version:  dev
    Path:     C:\Program Files\Docker\cli-plugins\docker-mcp.exe
  model: Docker Model Runner (Docker Inc.)
    Version:  v0.1.24
    Path:     C:\Program Files\Docker\cli-plugins\docker-model.exe
  sbom: View the packaged-based Software Bill Of Materials (SBOM) for an image (Anchore Inc.)
    Version:  0.6.0
    Path:     C:\Program Files\Docker\cli-plugins\docker-sbom.exe
  scout: Docker Scout (Docker Inc.)
    Version:  v1.18.0
    Path:     C:\Program Files\Docker\cli-plugins\docker-scout.exe

Server:
 Containers: 0
  Running: 0
  Paused: 0
  Stopped: 0
 Images: 5
 Server Version: 28.2.2
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Using metacopy: false
  Native Overlay Diff: true
  userxattr: false
 Logging Driver: json-file
 Cgroup Driver: cgroupfs
 Cgroup Version: 2
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local splunk syslog
 CDI spec directories:
  /etc/cdi
  /var/run/cdi
 Swarm: inactive
 Runtimes: io.containerd.runc.v2 nvidia runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 05044ec0a9a75232cad458027ca83437aae3f4da
 runc version: v1.2.5-0-g59923ef
 init version: de40ad0
 Security Options:
  seccomp
   Profile: builtin
  cgroupns
 Kernel Version: 6.6.87.1-microsoft-standard-WSL2
 Operating System: Docker Desktop
 OSType: linux
 Architecture: x86_64
 CPUs: 16
 Total Memory: 15.22GiB
 Name: docker-desktop
 ID: a09b8b3a-6e97-46ff-8a0f-89eb0e916c29
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 HTTP Proxy: http.docker.internal:3128
 HTTPS Proxy: http.docker.internal:3128
 No Proxy: hubproxy.docker.internal
 Labels:
  com.docker.desktop.address=npipe://\\.\pipe\docker_cli
 Experimental: false
 Insecure Registries:
  hubproxy.docker.internal:5555
  ::1/128
  127.0.0.0/8
 Live Restore Enabled: false

WARNING: DOCKER_INSECURE_NO_IPTABLES_RAW is set

What happened?

Running a ServiceBusContainer on Windows results in a Timeout exception.

I would expect the container to start.

The following code:

string ConfigFilePath = Path.Combine(AppContext.BaseDirectory, "ParticipationsConfig.json");

_emulator = new ServiceBusBuilder()
            .WithBindMount(ConfigFilePath, "/ServiceBus_Emulator/ConfigFiles/Config.json")
            .WithAcceptLicenseAgreement(true)
            .Build();

await _emulator.StartAsync();

This results in the following error:
ystem.TimeoutException: The operation has timed out.. Aborting test execution.

Stack Trace: 
WaitStrategy.WaitUntilAsync(Func1 wait, TimeSpan interval, TimeSpan timeout, Int32 retries, CancellationToken ct) DockerContainer.CheckReadinessAsync(IEnumerable1 waitStrategies, CancellationToken ct)
DockerContainer.UnsafeStartAsync(CancellationToken ct)
DockerContainer.StartAsync(CancellationToken ct)
ServiceBusContainer.UnsafeStartAsync(CancellationToken ct)
DockerContainer.StartAsync(CancellationToken ct)
ServiceBusTestBase.AssemblyInitialize(TestContext context) line 32

Standard Output: 

[testcontainers.org 00:00:00.18] Connected to Docker:
  Host: npipe://./pipe/docker_engine
  Server Version: 28.2.2
  Kernel Version: 6.6.87.1-microsoft-standard-WSL2
  API Version: 1.50
  Operating System: Docker Desktop
  Total Memory: 15.22 GB
  Labels: 
    com.docker.desktop.address=npipe://\\.\pipe\docker_cli
[testcontainers.org 00:00:00.28] Docker network 6b8dc85e4e8c created
[testcontainers.org 00:00:00.47] Docker container 6a3604e93ee0 created
[testcontainers.org 00:00:00.51] Start Docker container 6a3604e93ee0
[testcontainers.org 00:00:01.88] Wait for Docker container 6a3604e93ee0 to complete readiness checks
[testcontainers.org 00:00:01.89] Docker container 6a3604e93ee0 ready
[testcontainers.org 00:00:02.00] Docker container 4cdfd56f6f6c created
[testcontainers.org 00:00:02.01] Start Docker container 4cdfd56f6f6c
[testcontainers.org 00:00:03.33] Wait for Docker container 4cdfd56f6f6c to complete readiness checks
[testcontainers.org 00:00:03.34] Execute "/bin/sh -c find /opt/mssql-tools*/bin/sqlcmd -type f -print -quit" at Docker container 4cdfd56f6f6c
[testcontainers.org 00:00:03.44] Execute "/opt/mssql-tools18/bin/sqlcmd -C -Q SELECT 1;" at Docker container 4cdfd56f6f6c
[testcontainers.org 00:00:12.59] Execute "/opt/mssql-tools18/bin/sqlcmd -C -Q SELECT 1;" at Docker container 4cdfd56f6f6c
[testcontainers.org 00:00:13.74] Execute "/opt/mssql-tools18/bin/sqlcmd -C -Q SELECT 1;" at Docker container 4cdfd56f6f6c
[testcontainers.org 00:00:13.84] Docker container 4cdfd56f6f6c ready
[testcontainers.org 00:00:13.97] Docker container 65287c9659e1 created
[testcontainers.org 00:00:13.98] Start Docker container 4cdfd56f6f6c
[testcontainers.org 00:00:29.04] Stop Docker container 65287c9659e1
[testcontainers.org 00:00:29.05] Stop Docker container 4cdfd56f6f6c
[testcontainers.org 00:00:29.75] Stop Docker container 65287c9659e1
[testcontainers.org 00:00:29.77] Stop Docker container 4cdfd56f6f6c

Some things to note:

  • The MsSql Containers are able to start up and run, but when it gets to the actual emulator container
    [azure-messaging/servicebus-emulator:latest] this one never starts. It also does not leave any log messages.

  • This works with the previous version of Docker Desktop for Windows (4.41.*), so this could very well be a Docker issue. I have been able to get the latest version of Docker Desktop to work with Testcontainers v4.1. Anything after 4.1 throws the same error. Looking through the code I believe that's around the time that a change was made to ServiceBus to allow custom networks for database container communication.

Relevant log output

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions