title: Problems running Kafka with Docker Compose in Windows
body: <p>I'm trying to run Kafka locally on Windows 10 Pro and Docker Desktop (not toolbox). Everything seems to work perfectly, but I can't reach Kafka with my application and neither use kafka rest (<a href="http://localhost:8082/topics" rel="nofollow noreferrer">http://localhost:8082/topics</a> | <a href="http://127.0.0.1:8082/topics" rel="nofollow noreferrer">http://127.0.0.1:8082/topics</a> | <a href="http://192.168.1.103:8082/topics" rel="nofollow noreferrer">http://192.168.1.103:8082/topics</a> - this last one is my docker ip in hosts)</p>
  
  <p>My docker-compose file is:</p>
  
  <pre><code>version: '2'
  
  services:
  
    # https://hub.docker.com/r/confluentinc/cp-zookeeper/tags
    zookeeper:
      image: confluentinc/cp-zookeeper:5.3.1
      container_name: zookeeper
      hostname: zookeeper
      network_mode: host
      ports:
        - "2181:2181"
        - "32181:32181"
      environment:
        ZOOKEEPER_CLIENT_PORT: 2181
  
    # https://hub.docker.com/r/confluentinc/cp-kafka/tags
    kafka:
      image: confluentinc/cp-kafka:5.3.1
      container_name: kafka
      hostname: kafka
      network_mode: host
      ports:
        - "9092:9092"
        - "29092:29092"
      restart: always
      environment:
        KAFKA_ADVERTISED_HOST_NAME: localhost
        KAFKA_CREATE_TOPICS: "test:1:1"
        KAFKA_AUTO_CREATE_TOPICS_ENABLE: "true"
        KAFKA_ZOOKEEPER_CONNECT: localhost:2181
        KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://localhost:9092
        KAFKA_BROKER_ID: 2
        KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
      depends_on:
        - zookeeper
  
    schema-registry:
      image: confluentinc/cp-schema-registry:5.3.1
      hostname: schema-registry
      container_name: schema-registry
      network_mode: host
      depends_on:
        - zookeeper
        - kafka
      ports:
        - "8081:8081"
      environment:
        SCHEMA_REGISTRY_KAFKASTORE_CONNECTION_URL: localhost:2181
        SCHEMA_REGISTRY_HOST_NAME: localhost
        SCHEMA_REGISTRY_LISTENERS: http://localhost:8081
  
    kafka-rest:
      image: confluentinc/cp-kafka-rest:5.3.1
      hostname: kafka-rest
      container_name: kafka-rest
      network_mode: host
      depends_on:
        - zookeeper
        - kafka
      ports:
        - "8082:8082"
      environment:
        KAFKA_REST_HOST_NAME: localhost
        KAFKA_REST_ZOOKEEPER_CONNECT: localhost:2181
        KAFKA_REST_LISTENERS: http://localhost:8082
        KAFKA_REST_SCHEMA_REGISTRY_URL: http://localhost:8081
  
  </code></pre>
  
  <p>And my hosts file is:</p>
  
  <pre><code># Copyright (c) 1993-2009 Microsoft Corp.
  #
  # This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
  #
  # This file contains the mappings of IP addresses to host names. Each
  # entry should be kept on an individual line. The IP address should
  # be placed in the first column followed by the corresponding host name.
  # The IP address and the host name should be separated by at least one
  # space.
  #
  # Additionally, comments (such as these) may be inserted on individual
  # lines or following the machine name denoted by a '#' symbol.
  #
  # For example:
  #
  #      102.54.94.97     rhino.acme.com          # source server
  #       38.25.63.10     x.acme.com              # x client host
  
  # localhost name resolution is handled within DNS itself.
  #   127.0.0.1       localhost
  #   ::1             localhost
  192.168.1.103 host.docker.internal
  192.168.1.103 gateway.docker.internal
  # Added by Docker Desktop
  192.168.2.236 host.docker.internal
  192.168.2.236 gateway.docker.internal
  # To allow the same kube context to work on the host and the container:
  127.0.0.1 kubernetes.docker.internal
  # End of section
  127.0.0.1 kafka
  
  </code></pre>
  
  <p>In the logs I've got messages like
  "kafka-rest         | [2019-10-21 11:40:57,903] INFO Server started, listening for requests... (io.confluent.kafkarest.KafkaRestMain)"</p>
  
  <p>I don't know what I'm doing wrong
  I've tried to follow some instructions on other posts:</p>
  
  <ul>
  <li><p><a href="https://stackoverflow.com/questions/44004775/kafka-with-docker-problems">Kafka with Docker Problems</a></p></li>
  <li><p><a href="https://stackoverflow.com/questions/42211544/confluent-kafka-docker-compose-error-running-example">Confluent Kafka &amp; docker-compose - error running example</a></p></li>
  <li><p><a href="https://stackoverflow.com/questions/43045590/kafka-setup-with-docker-compose">Kafka setup with docker-compose</a></p></li>
  <li><p>And many other on Google</p></li>
  </ul>