Git Product home page Git Product logo

docker-kafka-1's Introduction

Kafka on Docker

This Dockerfile creates a Docker image that can be used as the base for running Kafka within a Docker container. The Kafka service is ran by the run.sh script which is in charge of setting up the Kafka configuration from environment variables passed to the container when it is run.

The version of Kafka is defined in the Dockerfile and currently points at the last available beta release.

Environment variables

The following environment variables are understood by the startup script to seed the service's configuration:

  • SERVICE_NAME should contain the logical name of the service this container is an instance of;

  • CONTAINER_NAME should contain the logical name of the container, which will be used for looking up links and ports informations from the other environment variables. For this, the name is uppercased and non-alphanumeric characters are replaced by underscores;

  • CONTAINER_HOST_ADDRESS should contain the address of the Docker container's host. It' used by Kafka as the address advertised to ZooKeeper for broker discovery and is required for the container to start;

  • ZOOKEEPER_BASE, the ZooKeeper tree chroot for Kafka to use in the zookeeper.connect string and properly namespace the Kafka zNodes for this deployment. Defaults to /local/kafka;

  • BROKER_ID, which controls the broker.id configuration setting and useful for multi-node Kafka clusters. Defaults to 0.

  • <SERVICE_NAME>_<CONTAINER_NAME>_BROKER_PORT, which controls which port the Kafka broker will listen on. Defaults to 9092;

Kafka depends on ZooKeeper for discovery. It thus expects the following environment variables to be defined for each ZooKeeper node to construct the node list: ZOOKEEPER_<ZK_NODE_NAME>_HOST and ZOOKEEPER_<ZK_NODE_NAME>_CLIENT_PORT. The ZOOKEEPER_BASE will be append to each host:port to set the zNode path chroot. The resulting list is used for the zookeeper.connect configuration setting.

Volumes

The Kafka image uses the following volumes you may want to bind from the container's host:

  • /var/lib/kafka, where the Kafka logs will be stored for each topic.

Usage

To build a new image, simply run from this directory:

$ docker build -t `whoami`/kafka .

The Docker image will be built and now available in Docker to start a new container from:

$ docker images | grep kafka
mpetazzoni/kafka       latest         6c58d1f6ff3c        5 seconds ago       12.29 kB (virtual 900.1 MB)

docker-kafka-1's People

Contributors

mpetazzoni avatar kpruden avatar psi-signalfuse avatar

Watchers

James Cloos avatar lingya avatar  avatar

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.