[英]Kafka container don't start because the docker Warning : Published ports are discarded when using host network mode
I have some Kafka docker tests on jenkins working with some different SO images, but if I tried to execute this in local fails,because of warning publish ports are discarded wh host net mode.我对 jenkins 进行了一些 Kafka docker 测试,使用了一些不同的 SO 图像,但是如果我尝试在本地执行它失败,因为警告发布端口在主机网络模式下被丢弃。 In my java classes structure I have a KafkaContainer class that extends DockerContainer class with this method:
在我的 java 类结构中,我有一个 KafkaContainer 类,它使用这种方法扩展了 DockerContainer 类:
private static String[] getKafkaConfigs(){
return new String[]{"--network=host"};
}
After that I run that Kafka instance with ZookeperContainer, this ZookeperContainer as well, it have got the same method config:之后,我使用 ZookeperContainer 运行该 Kafka 实例,这个 ZookeperContainer 也是如此,它具有相同的方法配置:
return new String[]{"--network=host"};
The ports are the Kafka (9092) and zookeper(2181) commons ports.端口是 Kafka (9092) 和 zookeper(2181) 公共端口。 In my port 8080, the localhost server running.
在我的 8080 端口,本地主机服务器正在运行。 Any idea, how can I fix it to execute this in a localhost environment.
任何想法,我如何修复它以在本地主机环境中执行它。
Thank you谢谢
Changing to PODMAN solved the problem.更改为 PODMAN 解决了问题。 I've read some articles like https://computingforgeeks.com/using-podman-and-libpod-to-run-docker-containers/ and others.
我读过一些文章,如https://computingforgeeks.com/using-podman-and-libpod-to-run-docker-containers/等。 It's an excellent alternative and complete CLI compatibility with Docker.
这是一个很好的替代方案,并且与 Docker 的 CLI 完全兼容。 BTW, if anyone has a better solution with docker native, please don't hesitate to post it, thank you.
顺便说一句,如果有人对 docker native 有更好的解决方案,请不要犹豫,发布它,谢谢。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.