Schema Registry container: Server died unexpectedly when launching using docker-compose

I have written docker-compose.yml file to create the following containers:

  • Confluent-Zookeeper
  • Confluent-Kafka
  • Confluent-Schema Registry

I want a single docker-compose file to spun up the necessary containers, expose required ports and interconnect the dependent containers. The goal is to have
I am using the official confluent images from Docker Hub.
My docker-compose file looks like this:

  • Changing zookeeper cluster leadership when leader dies
  • Kafka setup with docker-compose
  • Cant produce-to OR consume-from kafka broker running inside a container
  • Using confluent-kafka python client in alpine container
  • Kafka log directories in Docker
  • Second and Third Distributed Kafka Connector workers failing to work correctly
  • zookeeper:
      image: confluent/zookeeper
      container_name: confluent-zookeeper
      hostname: zookeeper
      environment:
        ZOOKEEPER_CLIENT_PORT: 2181
      ports:
        - "2181:2181"
    
    kafka:
      environment:
        KAFKA_ZOOKEEPER_CONNECTION_STRING: zookeeper:2181
        KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://kafka:9092
      image: confluent/kafka
      container_name: confluent-kafka
      hostname: kafka
      links:
        - zookeeper
      ports:
        - "9092:9092"
    
    schema-registry:
      image: confluent/schema-registry
      container_name: confluent-schema_registry
      environment:
        SCHEMA_REGISTRY_KAFKASTORE_CONNECTION_URL: zookeeper:2181
        SCHEMA_REGISTRY_HOSTNAME: schema-registry
        SCHEMA_REGISTRY_LISTENERS: http://schema-registry:8081
        SCHEMA_REGISTRY_DEBUG: 'true'
        SCHEMA_REGISTRY_KAFKASTORE_TOPIC_REPLICATION_FACTOR: '1'
      links:
        - kafka
        - zookeeper
      ports:
        - "8081:8081"
    

    Now when I run docker-compose up, all these containers will be created and launched. But Schema Registry container exits immediately. docker logs gives the following output:

     (io.confluent.kafka.schemaregistry.rest.SchemaRegistryConfig:135)
    [2017-05-17 06:06:33,415] ERROR Server died unexpectedly:  (io.confluent.kafka.schemaregistry.rest.SchemaRegistryMain:51)
    org.apache.kafka.common.config.ConfigException: Only plaintext and SSL Kafka endpoints are supported and none are configured.
            at io.confluent.kafka.schemaregistry.storage.KafkaStore.getBrokerEndpoints(KafkaStore.java:254)
            at io.confluent.kafka.schemaregistry.storage.KafkaStore.<init>(KafkaStore.java:111)
            at io.confluent.kafka.schemaregistry.storage.KafkaSchemaRegistry.<init>(KafkaSchemaRegistry.java:136)
            at io.confluent.kafka.schemaregistry.rest.SchemaRegistryRestApplication.setupResources(SchemaRegistryRestApplication.java:53)
            at io.confluent.kafka.schemaregistry.rest.SchemaRegistryRestApplication.setupResources(SchemaRegistryRestApplication.java:37)
            at io.confluent.rest.Application.createServer(Application.java:117)
            at io.confluent.kafka.schemaregistry.rest.SchemaRegistryMain.main(SchemaRegistryMain.java:43)
    

    I searched for this issue but nothing helped. I tried various other configurations like providing KAFKA_ADVERTISED_HOSTNAME, changing SCHEMA_REGISTRY_LISTENERS value, etc. but no luck.
    Can anybody point out the exact configuration issue why Schema Registry container is failing?

  • Best Kubernetes Nginx Architecture
  • how to install/start docker engine service inside a docker container
  • Docker for Windows Server 2016 requires update KB3176936
  • Running commands inside Docker Container
  • How can we mount volume on a container that's running without commit, stopping or pausing it?
  • Docker container mongod error when starting via ssh
  • 2 Solutions collect form web for “Schema Registry container: Server died unexpectedly when launching using docker-compose”

    You’re missing the hostname (hostname: schema-registry) entry in the failing container. By default Docker will populate a container’s /etc/hosts with the linked containers’ aliases and names, plus the hostname of self.

    Those are old and deprecated docker images. Use the latest supported docker images from confluentinc https://hub.docker.com/u/confluentinc/

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.