GithubHelp home page GithubHelp logo

spotx / docker-kafka Goto Github PK

View Code? Open in Web Editor NEW

This project forked from spotify/docker-kafka

0.0 1.0 1.0 1.19 MB

Kafka (and Zookeeper) in Docker

License: Apache License 2.0

Shell 83.82% Dockerfile 16.18%
docker kafka

docker-kafka's Introduction

Kafka in Docker

This repository provides everything you need to run Kafka in Docker.

Updated for Kafka 0.10.2.0.

Why?

The main hurdle of running Kafka in Docker is that it depends on Zookeeper. Compared to other Kafka docker images, this one runs both Zookeeper and Kafka in the same container. This means:

  • No dependency on an external Zookeeper host, or linking to another container.
  • Zookeeper and Kafka are configured to work together out of the box.

Simple Run

Start the container:

docker run -p 2181:2181 -p 9092:9092 spotx/kafka:1.0.0

Write a test message to kafka:

docker exec -it <container_id> ./opt/kafka_2.11-1.0.0/bin/kafka-console-producer.sh --broker-list localhost:9092 --topic test

Read the test message:

docker exec -it <container_id> ./opt/kafka_2.11-1.0.0/bin/kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic test --from-beginning

Complex Run

In a more complex setup, internal and external listeners can be defined to allow access from outside the container

  1. Configure with Docker Compose file:
version: '3'
services:
  kafka:
    image: spotx/kafka:1.0.0
    ports:
    - "2181:2181"
    - "9092:9094"
    environment:
      KAFKA_LISTENERS: INTERNAL://kafka:9092,EXTERNAL://kafka:9094
      KAFKA_ADVERTISED_LISTENERS: INTERNAL://kafka:9092,EXTERNAL://localhost:9094
      KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: INTERNAL:PLAINTEXT,EXTERNAL:PLAINTEXT
      KAFKA_INTER_BROKER_LISTENER_NAME: INTERNAL
  1. Start service
docker-compose -f <compose_file>.yml up

Write a test message to kafka:

kafka-console-producer.sh --broker-list localhost:9092 --topic test

Read the test message:

kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic test --from-beginning

In the box

  • spotx/kafka

    The docker image with both Kafka and Zookeeper. Built from the kafka directory.

Public Builds

https://hub.docker.com/r/spotx/kafka/

Build from Source

docker build -t spotx/kafka kafka/

Todo

  • Not particularily optimzed for startup time.
  • Better docs

docker-kafka's People

Contributors

apiri avatar jamieirvine avatar jonaslindmark avatar mattnworb avatar mbruggmann avatar rohansingh avatar sherzberg avatar yutaono avatar

Watchers

 avatar

Forkers

jamieirvine

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.