@Test
    public void testDockerHubElasticsearch8ImageSecureByDefault() throws Exception {
        try (ElasticsearchContainer container = new ElasticsearchContainer("elasticsearch:8.1.2")) {
            container.start();

            assertClusterHealthResponse(container);
        }
    }
From 6.8, we can optionally activate security with a default password.
modules/elasticsearch/src/test/java/org/testcontainers/elasticsearch/ElasticsearchContainerTest.java