0

I have just started using testcontainers and I am getting into issues. Below is my code:

 @ClassRule
    public static GenericContainer redisContainer =
            new GenericContainer("corporateurl/redis:latest")
                   .withExposedPorts(6379);

When I run this without the exposedPorts it works fine but with exposedPorts it gives an error:

Could not start container
java.lang.IllegalStateException: Container did not start correctly.

Any idea how to prevent that?

Sachin Jain
  • 97
  • 1
  • 10

1 Answers1

0

It's really hard to say since the exception doesn't provide any clues, I would suggest you try accessing logs: https://www.testcontainers.org/features/container_logs/

Is 6379 available on localhost at the moment you start your test, any chance there is some other container?

Vitaly Chura
  • 704
  • 8
  • 13