How to install Kafka using Docker?

Aryan Arabshahi
September 17, 2021
Share:

Apache Kafka is an open-source distributed event streaming platform used by thousands of companies for high-performance data pipelines, streaming analytics, data integration, and mission-critical applications. At first, it was conceived as a messaging queue but it has quickly evolved from messaging queue to a full-fledged event streaming platform. In this article, we are going to install it using Docker on Debian 10. The whole installation process contains two simple steps:

Create the “docker-compose.yml” file:

version: '3.7'

services:

    zookeeper:
        image: 'bitnami/zookeeper:latest'
        container_name: zookeeper
        volumes:
            - zookeeper:/bitnami
        environment:
            - ALLOW_ANONYMOUS_LOGIN=yes

    kafka:
        image: 'bitnami/kafka:latest'
        hostname: kafka.codewithcoffee.dev
        container_name: kafka
        ports:
            - 9092:9092
        volumes:
            - kafka:/bitnami
        environment:
            - KAFKA_CFG_ZOOKEEPER_CONNECT=zookeeper:2181
            - ALLOW_PLAINTEXT_LISTENER=yes
        depends_on:
            - zookeeper

volumes:

    zookeeper:
        driver: local

    kafka:
        driver: local

And, Run the services:

docker-compose up -d

Now, you can enjoy Kafka's power ;)