networking - Kafka Docker network_mode -
i'm trying kafka , running on mac using docker compose.
this docker-compose.yml file:
version: '2' services: zookeeper: image: ******** network_mode: "host" hostname: "zookeeper" environment: - "myid=1" ports: - "2181:2181" - "3888:3888" mysql: image: ******* network_mode: "host" hostname: "mysql" environment: - "mysql_root_password=password" ports: - "3306:3306" schema-registry: image: ******** network_mode: "host" hostname: "schema-registry" environment: - "zookeeper_url=127.0.0.1:2181" ports: - "8081:8081" kafka: image: ********** network_mode: "host" hostname: "kafka" environment: - "service_name=localhost" - "service_tags=syracuse-dev" - "kafka_advertised_host_name=localhost" - "kafka_zookeeper_connect=localhost:2181" - "kafka_num_partitions=10" - "kafka_listeners=plaintext://:9092" - "kafka_broker_id=1" - "kafka_default_replication_factor=1" ports: - "9092:9092" - "7203:7203"
everything gets , running exception of kafka. kafka loads looks zookeeper once found receive following error.
found zookeeper error: exception thrown agent : java.net.malformedurlexception: local host name unknown: java.net.unknownhostexception: moby: moby: unknown error
i able kafka , running removing "network_mode: "host" lines each container. , setting zookeeper url to: "zookeeper:2181"
it's unclear me network_mode , why impeded kafka running. i'm hoping can shed light onto , educate me.
much appreciated
you may instead of
- "kafka_advertised_host_name=localhost" - "kafka_zookeeper_connect=localhost:2181"
provide them name of zookeeper container, zookeeper
in case.
- "kafka_advertised_host_name=zookeeper" - "kafka_zookeeper_connect=zookeper:2181"
does help?
Comments
Post a Comment