admin管理员组文章数量:1126346
I have a spring boot integration test using kafka testcontainer(v1.19.8). The test runs fine in local environment. In contrast, when running in Gitlab CI pipeline the test fails with the following error:
Exception in thread "main" java.lang.IllegalArgumentException: requirement failed: advertised.listeners cannot use the nonroutable meta-address 0.0.0.0. Use a routable IP address.
My Gitlab CI job looks like the following:
# DinD service is required for Testcontainers
services:
- name: docker:dind
# explicitly disable tls to avoid docker startup interruption
command: ["--tls=false"]
variables:
# Instruct Testcontainers to use the daemon of DinD, use port 2375 for non-tls connections.
DOCKER_HOST: "tcp://docker:2375"
# Instruct Docker not to start over TLS.
DOCKER_TLS_CERTDIR: ""
# Improve performance with overlayfs.
DOCKER_DRIVER: overlay2
test:
image: gradle:5.0
stage: test
script: ./gradlew test
I didn't set KAFKA_ADVERTISED_LISTENERS for my test container as I don't know the mapped port in advance. The mapped port is only available after I start the testcontainer and after started, the addEnv()
method on the KafkaContainer
is not usable to redefine the value of advertised listeners.
Questions:
Is there anything I can change in gitlab-ci job configuration so that kafka testcontainer stops using 0.0.0.0 in KAFKA_ADVERTISED_LISTENERS ?
Is there any solution using
KafkaContainer
or I have to switch toFixedHostPortGenericContainer
(although I don't like the idea of a fixed port and the constructor ofFixedHostPortGenericContainer
is deprecated) ?
本文标签: dockerKafka TestContainer advertised listeners configuration when using DinDStack Overflow
版权声明:本文标题:docker - Kafka TestContainer advertised listeners configuration when using DinD - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736682853a1947511.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论