Код: Выделить всё
private GenericContainer createKafkaContainer() {
try (GenericContainer kafkaContainer = new GenericContainer(DockerImageName.parse("confluentinc/cp-kafka"))
.withEnv(kafkaProperties)
.withExposedPorts(9092)
.withNetwork(network)
.withNetworkAliases("my-kafka")
.withCreateContainerCmdModifier(cmd -> cmd.withHostConfig(
new HostConfig()
.withPortBindings(new PortBinding(Ports.Binding.bindPort(9092), new ExposedPort(9092)))
))
.withCreateContainerCmdModifier(cmd -> cmd.withHostName("my-kafka"))
.withCreateContainerCmdModifier(cmd -> cmd.withName("my-kafka"))
) {
return kafkaContainer;
}
Код: Выделить всё
Network network = Network.newNetwork();
Код: Выделить всё
2024-12-07T21:14:12.895-08:00 WARN 74816 --- [ntainers-wait-0] .c.w.i.InternalCommandPortListeningCheck : An exception while executing the internal check: Container.ExecResult(exitCode=137, stdout=, stderr=Ncat: Version 7.70 ( https://nmap.org/ncat )
Ncat: Connection to ::1 failed: Connection refused.
Ncat: Trying next address...
Ncat: Connection refused.
/bin/bash: connect: Connection refused
/bin/bash: /dev/tcp/localhost/9092: Connection refused
Ncat: Version 7.70 ( https://nmap.org/ncat )
Ncat: Connection to ::1 failed: Connection refused.
Ncat: Trying next address...
Ncat: Connection refused.
/bin/bash: connect: Connection refused
/bin/bash: /dev/tcp/localhost/9092: Connection refused
Ncat: Version 7.70 ( https://nmap.org/ncat )
Ncat: Connection to ::1 failed: Connection refused.
Ncat: Trying next address...
Ncat: Connection refused.
/bin/bash: connect: Connection refused
/bin/bash: /dev/tcp/localhost/9092: Connection refused
Подробнее здесь: https://stackoverflow.com/questions/792 ... nreachable