@Test
    public void testThatAuthLocatorIsUsedForDockerfileBuild() throws IOException {
        // Prepare a simple temporary Dockerfile which requires our custom private image
        Path tempFile = getLocalTempFile(".Dockerfile");
        String dockerFileContent = "FROM " + testImageName.asCanonicalNameString();
        Files.write(tempFile, dockerFileContent.getBytes());

        // Start a container built from a derived image, which will require an authenticated pull
        try (
            final GenericContainer<?> container = new GenericContainer<>(
                new ImageFromDockerfile().withDockerfile(tempFile)
            )
                .withCommand("/bin/sh", "-c", "sleep 10")
        ) {
            container.start();

            assertThat(container.isRunning()).as("container started following an authenticated pull").isTrue();
        }
    }
Containerised docker image registry, with simple hardcoded credentials
core/src/test/java/org/testcontainers/utility/AuthenticatedImagePullTest.java