
Docker image containing a standard Kafka distribution.
Currently supported versions:
Image details:
To start the Kafka Docker image:
docker run -i -t bde2020/kafka /bin/bash
To build the Kafka Docker image:
bashgit clone https://github.com/big-data-europe/docker-kafka.git docker build -t bde2020/kafka .
To start a Kafka Server inside this Docker image
bashcd /usr/local/apache-kafka/current ./bin/kafka-start-server.sh ./config/server.properties
bashcd /usr/local/apache-kafka/current ./bin/kafka-start-server.sh ./config/server.properties \ --override zookeeper.connect=192.168.88.219:2181,192.168.88.229:2181
To start Kafka Docker image on Marathon:
json{ "container": { "type": "DOCKER", "volumes": [ { "containerPath": "/tmp/kafka-logs", "hostPath": "/var/lib/bde/kafka-logs", "mode": "RW" } ], "docker": { "network": "BRIDGE", "image": "bde2020/docker-kafka", "privileged":true, "portMappings": [ { "containerPort": 9092, "hostPort": 9092} ] } }, "id":"apache-kafka", "cpus": 0.2, "mem": 512, "cmd": "cd /usr/local/apache-kafka/current && ./bin/kafka-server-start.sh ./config/server.properties --override zookeeper.connect=192.168.88.219:2181,192.168.88.220:2181,192.168.88.221:2181/kafka --override delete.topic.enable=true --override advertised.host.name=$HOST --override advertised.port=$PORT0", "instances":1, "ports":[9092], "requirePorts":true, "constraints":[["hostname","UNIQUE",""]] }
To create a Kafka topic:
bashdocker ps
on one of the hosts. This will expose the containerId of the running bde2020/docker-kafka container, e.g. 8b797c0d80b3.
bashdocker exec -t -i 8b797c0d80b3 /bin/bash
Inside the docker container cd into /usr/local/apache-kafka/current. Issue the following command to see available options for topic creation.
bash./bin/kafka-topics.sh --help
bash./bin/kafka-topics.sh --create --topic sampleTopic \ --zookeeper 192.168.88.219:2181/kafka \ --partitions 3 \ --replication-factor 1
bash./bin/kafka-topics.sh --list --zookeeper 192.168.88.219:2181/kafka
bash./bin/kafka-console-producer.sh --topic sampleTopic --broker-list bigdata-one.example.com:9092
After starting the producer simply type in some messages in the console and hit enter after every single message, we will consume these messages in the next step. Hit ctrl-c to stop the producer.
bash./bin/kafka-console-consumer.sh --topic sampleTopic \ --zookeeper 192.168.88.219:2181/kafka \ --bootstrap-server bigdata-one.example:9092 --from-beginning
To run the Kafka Image on the BDE Platform:
To run easily integrated with the BDE Platform this image provides the possibility to startup Apache Kafka and create a Kafka topic (in case it doesn't exist) using json config files.
These json files correspond to the many options that are available from Apache Kafka and are translated to Apache Kafka shell commands on the fly.
To run the Apache Kafka image using the BDE Platform, it is necessary to extend this image, adding to json files (see below) to the /config directory.
bashFROM bde2020/kafka ADD kafka-startup.json /config/ ADD kafka-init.json /config/
json[ { "sh":"/app/bin/kafka-server-start.sh", "./config/server.properties":"", "--override":"-Djava.net.preferIPv4Stack=true", "--override":"zookeeper.connect=192.168.88.219:2181,192.168.88.220:2181,192.168.88.221:2181/kafka" } ]
* The kafka-init.json (example, the options are dependent on the use case) ```json [ { "sh":"/app/bin/kafka-topics.sh", "--zookeeper":"192.168.88.219:2181,192.168.88.220:2181,192.168.88.221:2181/kafka", "--create":"", "--topic":"sampleTopic", "--partitions":"3", "--replication-factor":"1" } ]
bash/app/bin/kafka-init
To run a Apache Kafka Cluster on docker-swarm
your-kafka-1: image: "your/kafka-extension" depends_on: - your_zookeeper_1 - your_zookeeper_2 - your_zookeeper_3 ports: - 9092:9092 command: "bash -c /app/bin/kafka-init" hostname: "your-kafka-1" your-kafka-2: image: "your/kafka-extension" depends_on: - your_zookeeper_1 - your_zookeeper_2 - your_zookeeper_3 ports: - 9092:9092 command: "bash -c /app/bin/kafka-init" hostname: "your-kafka-2" your-kafka-3: image: "your/kafka-extension" depends_on: - your_zookeeper_1 - your_zookeeper_2 - your_zookeeper_3 ports: - 9092:9092 command: "bash -c /app/bin/kafka-init" hostname: "your-kafka-3"
以下是 bde2020/kafka 相关的常用 Docker 镜像,适用于 不同场景 等不同场景:
您可以使用以下命令拉取该镜像。请将 <标签> 替换为具体的标签版本。如需查看所有可用标签版本,请访问 标签列表页面。
探索更多轩辕镜像的使用方法,找到最适合您系统的配置方式
通过 Docker 登录认证访问私有仓库
无需登录使用专属域名
Kubernetes 集群配置 Containerd
K3s 轻量级 Kubernetes 镜像加速
VS Code Dev Containers 配置
Podman 容器引擎配置
HPC 科学计算容器配置
ghcr、Quay、nvcr 等镜像仓库
Harbor Proxy Repository 对接专属域名
Portainer Registries 加速拉取
Nexus3 Docker Proxy 内网缓存
需要其他帮助?请查看我们的 常见问题Docker 镜像访问常见问题解答 或 提交工单
docker search 限制
站内搜不到镜像
离线 save/load
插件要用 plugin install
WSL 拉取慢
安全与 digest
新手拉取配置
镜像合规机制
manifest unknown
no matching manifest(架构)
invalid tar header(解压)
TLS 证书失败
DNS 超时
域名连通性排查
410 Gone 排查
402 与流量用尽
401 认证失败
429 限流
D-Bus 凭证提示
413 与超大单层
来自真实用户的反馈,见证轩辕镜像的优质服务