@Override
    protected void containerIsStarting(InspectContainerResponse containerInfo) {
        String brokerAdvertisedListener = String.format(
            "BROKER://%s:%s",
            containerInfo.getConfig().getHostName(),
            "9093"
        );
        List<String> advertisedListeners = new ArrayList<>();
        advertisedListeners.add("PLAINTEXT://" + getBootstrapServers());
        advertisedListeners.add(brokerAdvertisedListener);

        advertisedListeners.addAll(KafkaHelper.resolveAdvertisedListeners(this.advertisedListeners));
        String kafkaAdvertisedListeners = String.join(",", advertisedListeners);

        String command = "#!/bin/bash\n";
        // exporting KAFKA_ADVERTISED_LISTENERS with the container hostname
        command += String.format("export KAFKA_ADVERTISED_LISTENERS=%s\n", kafkaAdvertisedListeners);

        command += "/etc/confluent/docker/run \n";
        copyFileToContainer(Transferable.of(command, 0777), KafkaHelper.STARTER_SCRIPT);
    }
Testcontainers implementation for Confluent Kafka.
<p>
Supported image: {@code confluentinc/cp-kafka}
<p>
Exposed ports: 9092
modules/kafka/src/main/java/org/testcontainers/kafka/ConfluentKafkaContainer.java