Skip to content

nats-streaming container won't start as Testcontainer #1733

@ghost

Description

Hi!

I am using testcontainers for Java in version 1.11.3.

When I use the redis container like this

    @ClassRule
    public static GenericContainer redis =
            new GenericContainer("redis:3.0.2")
                    .withExposedPorts(6379);

it starts without problems.

However when I start a nats-streaming container like this

    @ClassRule
    public static GenericContainer natsStreaming =
            new GenericContainer("nats-streaming:latest")
                    .withExposedPorts(4222);

it fails with this error message:

Caused by: org.testcontainers.containers.ContainerLaunchException: Timed out waiting for container port to open (localhost ports: [32791] should be listening)
	at org.testcontainers.containers.wait.strategy.HostPortWaitStrategy.waitUntilReady(HostPortWaitStrategy.java:47)
	at org.testcontainers.containers.wait.strategy.AbstractWaitStrategy.waitUntilReady(AbstractWaitStrategy.java:35)
	at org.testcontainers.containers.wait.HostPortWaitStrategy.waitUntilReady(HostPortWaitStrategy.java:23)
	at org.testcontainers.containers.wait.strategy.AbstractWaitStrategy.waitUntilReady(AbstractWaitStrategy.java:35)
	at org.testcontainers.containers.GenericContainer.waitUntilContainerStarted(GenericContainer.java:582)
	at org.testcontainers.containers.GenericContainer.tryStart(GenericContainer.java:259)
	... 21 more

Starting the nats-streaming container with @Rule results in the same error.

What could I be doing wrong?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions