简体   繁体   English

Kafka 容器无法启动,因为 docker 警告:使用主机网络模式时会丢弃已发布的端口

[英]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.

相关问题 Docker 警告:使用主机网络模式时,已发布的端口将被丢弃 - Docker WARNING: Published ports are discarded when using host network mode Kafka:从宿主机发布的事件不会被运行在 Docker 中的应用程序消费 - Kafka: events published from the host machine are not consumed by the application running in Docker Docker中没有连接,并且端口已公开并已发布 - No connection in docker with ports exposed and published 如何使用docker-java创建和启动Docker Container节点,分离模式 - How To Create And Start Docker Container node, detached mode using docker-java Docker:使用docker-java将端口从用户定义的网络发布到特定的主机IP地址 - Docker: Publishing ports from a user-defined network to a specific host IP address with docker-java Testcontainers,Docker in Docker with custom.network,容器不属于.network - Testcontainers, Docker in Docker with custom network, Containers don't belong to network 不使用 Docker 命令将文件从主机复制到 Docker 容器 - Copy files from host to Docker container without using Docker command Docker Cluster with Kafka 无法与客户端容器建立连接 - Docker Cluster with Kafka can't establish a connection with a client container 无法运行Spring集成测试,因为容器无法启动 - Cant run Spring integration test because container doesn't start Spring 作为 Docker 容器启动时,启动服务无法连接到 Spring 云配置服务器 - Spring Boot service can't connect to Spring Cloud Config Server when start as a Docker container
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM