<T> T runInsideDocker(
        DockerImageName imageName,
        Consumer<CreateContainerCmd> createContainerCmdConsumer,
        BiFunction<DockerClient, String, T> block
    ) {
        RemoteDockerImage dockerImage = new RemoteDockerImage(imageName);
        HashMap<String, String> labels = new HashMap<>(DEFAULT_LABELS);
        labels.putAll(ResourceReaper.instance().getLabels());
        CreateContainerCmd createContainerCmd = client.createContainerCmd(dockerImage.get()).withLabels(labels);
        createContainerCmdConsumer.accept(createContainerCmd);
        String id = createContainerCmd.exec().getId();

        try {
            client.startContainerCmd(id).exec();
            return block.apply(client, id);
        } finally {
            try {
                client.removeContainerCmd(id).withRemoveVolumes(true).withForce(true).exec();
            } catch (NotFoundException | InternalServerErrorException e) {
                log.debug("Swallowed exception while removing container", e);
            }
        }
    }
@return the IP address of the host running Docker
core/src/main/java/org/testcontainers/DockerClientFactory.java