Testcontainers – Run container with different database in integration test

During the maven package phase I build an docker image of my application:


In my integration test I use this image of my app as follows:

private static GenericContainer apiContainer =
        new GenericContainer("archetype/thorntail:0")

My question: How can I signal my container that it is running in an integration test and should therefore use a different database e.g. H2?

Source: StackOverflow