@Test
    public void incompatibleSettingsTest() {
        // The OSS image can not use security feature
        assertThat(
            catchThrowable(() -> {
                new ElasticsearchContainer("docker.elastic.co/elasticsearch/elasticsearch-oss:7.10.2")
                    .withPassword("foo");
            })
        )
            .as("We should not be able to activate security with an OSS License")
            .isInstanceOf(IllegalArgumentException.class);
    }
From 6.8, we can optionally activate security with a default password.
modules/elasticsearch/src/test/java/org/testcontainers/elasticsearch/ElasticsearchContainerTest.java