专属域名
文档搜索
轩辕助手
Run助手
邀请有礼
返回顶部
快速返回页面顶部
收起
收起工具栏
轩辕镜像 官方专业版
轩辕镜像 官方专业版轩辕镜像 官方专业版官方专业版
首页个人中心搜索镜像

交易
充值流量我的订单
工具
提交工单镜像收录一键安装
Npm 源Pip 源Homebrew 源
帮助
常见问题
其他
关于我们网站地图

官方QQ群: 1072982923

ches/kafka Docker 镜像 - 轩辕镜像 | Docker 镜像高效稳定拉取服务

热门搜索:openclaw🔥nginx🔥redis🔥mysqlopenjdkcursorweb2apimemgraphzabbixetcdubuntucorednsjdk
kafka
ches/kafka
自动构建
ches
Apache Kafka. Tagged versions. JMX. Cluster- and data volume-ready.
119 次收藏下载次数: 0状态:自动构建维护者:ches仓库类型:镜像最近更新:8 年前
轩辕镜像,快一点,稳很多。点击查看
镜像简介版本下载
轩辕镜像,快一点,稳很多。点击查看

Apache Kafka on Docker

This repository holds a build definition and supporting files for building a Docker image to run Kafka in containers. It is published as an Automated Build on Docker Hub, as ches/kafka.

This build intends to provide an operator-friendly Kafka deployment suitable for usage in a production Docker environment:

  • It runs one service, no bundled ZooKeeper (for more convenient development, use Docker Compose!).
  • Configuration is parameterized, enabling a Kafka cluster to be run from multiple container instances.
  • Kafka data and logs can be handled outside the container(s) using volumes.
  • JMX is exposed, for Kafka and JVM metrics visibility.

If you find any shortcomings with the build regarding operability, pull requests or feedback via GitHub issues are welcomed.

Usage Quick Start

Here is a minimal-configuration example running the Kafka broker service, then using the container as a client to run the basic producer and consumer example from the Kafka Quick Start:

# A non-default bridge network enables convenient name-to-hostname discovery
$ docker network create kafka-net

$ docker run -d --name zookeeper --network kafka-net zookeeper:3.4
$ docker run -d --name kafka --network kafka-net --env ZOOKEEPER_IP=zookeeper ches/kafka

$ docker run --rm --network kafka-net ches/kafka \
>   kafka-topics.sh --create --topic test --replication-factor 1 --partitions 1 --zookeeper zookeeper:2181
Created topic "test".

# In separate terminals:
$ docker run --rm --interactive --network kafka-net ches/kafka \
>   kafka-console-producer.sh --topic test --broker-list kafka:9092
<type some messages followed by newline>

$ docker run --rm --network kafka-net ches/kafka \
>   kafka-console-consumer.sh --topic test --from-beginning --bootstrap-server kafka:9092
Volumes

The container exposes two volumes that you may wish to bind-mount, or process elsewhere with --volumes-from:

  • /data: Path where Kafka's data is stored (log.dirs in Kafka configuration)
  • /logs: Path where Kafka's logs (INFO level) will be written, via log4j
Ports and Linking

The container publishes two ports:

  • 9092: Kafka's standard broker communication
  • 7203: JMX publishing, for e.g. jconsole or VisualVM connection

Kafka requires Apache ZooKeeper. You can satisfy the dependency by simply linking another container that exposes ZooKeeper on its standard port of 2181, as shown in the above example, ensuring that you link using an alias of zookeeper.

Alternatively, you may configure a specific address for Kafka to find ZK. See the Configuration section below.

A more complex local development setup

This example shows more configuration options and assumes that you wish to run a development environment with Kafka ports mapped directly to localhost, for instance if you're writing a producer or consumer and want to avoid rebuilding a container for it to run in as you iterate. This requires that localhost is your Docker host, i.e. your workstation runs Linux. If you're using something like boot2docker, substitute the value of boot2docker ip below.

bash
$ mkdir -p kafka-ex/{data,logs} && cd kafka-ex
$ docker run -d --name zookeeper --publish 2181:2181 zookeeper:3.4
$ docker run -d \
    --hostname localhost \
    --name kafka \
    --volume ./data:/data --volume ./logs:/logs \
    --publish 9092:9092 --publish 7203:7203 \
    --env KAFKA_ADVERTISED_HOST_NAME=127.0.0.1 --env ZOOKEEPER_IP=127.0.0.1 \
    ches/kafka

Configuration

Some parameters of Kafka configuration can be set through environment variables when running the container (docker run -e VAR=value). These are shown here with their default values, if any:

  • KAFKA_BROKER_ID=0

    Maps to Kafka's broker.id setting. Must be a unique integer for each broker in a cluster.

  • KAFKA_PORT=9092

    Maps to Kafka's port setting. The port that the broker service listens on. You will need to explicitly publish a new port from container instances if you change this.

  • KAFKA_ADVERTISED_HOST_NAME=<container's IP within docker0's subnet>

    Maps to Kafka's advertised.host.name setting. Kafka brokers gossip the list of brokers in the cluster to relieve producers from depending on a ZooKeeper library. This setting should reflect the address at which producers can reach the broker on the network, i.e. if you build a cluster consisting of multiple physical Docker hosts, you will need to set this to the hostname of the Docker host's interface where you forward the container KAFKA_PORT.

  • KAFKA_ADVERTISED_PORT=9092

    As above, for the port part of the advertised address. Maps to Kafka's advertised.port setting. If you run multiple broker containers on a single Docker host and need them to be accessible externally, this should be set to the port that you forward to on the Docker host.

  • KAFKA_DEFAULT_REPLICATION_FACTOR=1

    Maps to Kafka's default.replication.factor setting. The default replication factor for automatically created topics.

  • KAFKA_NUM_PARTITIONS=1

    Maps to Kafka's num.partitions setting. The default number of log partitions per topic.

  • KAFKA_AUTO_CREATE_TOPICS_ENABLE=true

    Maps to Kafka's auto.create.topics.enable.

  • KAFKA_INTER_BROKER_PROTOCOL_VERSION

    Maps to Kafka's inter.broker.protocol.version. If you have a cluster that runs brokers with different Kafka versions make sure they communicate with the same protocol version.

  • KAFKA_LOG_MESSAGE_FORMAT_VERSION

    Maps to Kafka's log.message.format.version. Specifies the protocol version with which your cluster communicates with its consumers.

  • KAFKA_LOG_RETENTION_HOURS=168

    Maps to Kafka's log.retention.hours. The number of hours to keep a log file before deleting it.

  • KAFKA_MESSAGE_MAX_BYTES

    Maps to Kafka's message.max.bytes. The maximum size of message that the server can receive. Default: ***

  • KAFKA_REPLICA_FETCH_MAX_BYTES

    Maps to Kafka's replica.fetch.max.bytes. The number of bytes of messages to attempt to fetch for each partition. This is not an absolute maximum, if the first message in the first non-empty partition of the fetch is larger than this value, the message will still be returned to ensure that progress can be made. The maximum message size accepted by the broker is defined via message.max.bytes (broker config) or max.message.bytes (topic config). Default: ***

  • JAVA_RMI_SERVER_HOSTNAME=$KAFKA_ADVERTISED_HOST_NAME

    Maps to the java.rmi.server.hostname JVM property, which is used to bind the interface that will accept remote JMX connections. Like KAFKA_ADVERTISED_HOST_NAME, it may be necessary to set this to a reachable address of the Docker host if you wish to connect a JMX client from outside of Docker.

  • ZOOKEEPER_IP=<taken from linked "zookeeper" container, if available>

    Required if no container is linked with the alias "zookeeper" and publishing port 2181, or not using ZOOKEEPER_CONNECTION_STRING instead. Used in constructing Kafka's zookeeper.connect setting.

  • ZOOKEEPER_PORT=2181

    Used in constructing Kafka's zookeeper.connect setting.

  • ZOOKEEPER_CONNECTION_STRING=<comma separated string of host:port pairs>

    Set a string with host:port pairs for connecting to a ZooKeeper Cluster. This setting overrides ZOOKEEPER_IP and ZOOKEEPER_PORT.

  • ZOOKEEPER_CHROOT, ex: /v0_8_1

    ZooKeeper root path used in constructing Kafka's zookeeper.connect setting. This is blank by default, which means Kafka will use the ZK /. You should set this if the ZK instance/cluster is shared by other services, or to accommodate Kafka upgrades that change schema. Starting in Kafka 0.8.2, it will create the path in ZK automatically; with earlier versions, you must ensure it is created before starting brokers.

JMX

Remote JMX access can be a bit of a pain to set up. The start script for this container tries to make it as painless as possible, but it's important to understand that if you want to connect a client like VisualVM from outside other Docker containers (e.g. directly from your host OS in development), then you'll need to configure RMI to be addressed as the Docker host IP or hostname. If you have set KAFKA_ADVERTISED_HOST_NAME, that value will be used and is probably what you want. If not (you're only using other containers to talk to Kafka brokers) or you need to override it for some reason, then you can instead set JAVA_RMI_SERVER_HOSTNAME.

For example in practice, if your Docker host is VirtualBox run by Docker Machine, a run command like this should allow you to connect VisualVM from your host OS to $(docker-machine ip docker-vm):7203:

$ docker run -d --name kafka -p 7203:7203 \
    --link zookeeper:zookeeper \
    --env JAVA_RMI_SERVER_HOSTNAME=$(docker-machine ip docker-vm) \
    ches/kafka

Note that it is fussy about port as well—it may not work if the same port number is not used within the container and on the host (any advice for workarounds is welcome).

Finally, please note that by default remote JMX has authentication and SSL turned off (these settings are taken from Kafka's own default start scripts). If you expose the JMX hostname/port from the Docker host in a production environment, you should make make certain that access is locked down appropriately with firewall rules or similar. A more advisable setup in a Docker setting would be to run a metrics collector in another container, and link it to the Kafka container(s).

If you need finer-grained configuration, you can totally control the relevant Java system properties by setting KAFKA_JMX_OPTS yourself—see start.sh.

Fork Legacy

This image/repo was originally forked from relateiq/kafka. My original motivations for forking were:

  • Change the Kafka binary source to an official Apache artifact. RelateIQ's was on a private S3 bucket, and this opaqueness is not suitable for a publicly-shared image for reasons of trust.
  • Changes described in this pull request.

After a period of unresponsiveness from upstream on pull requests and my repo tallying far more downloads on Docker Hub, I have made further updates and changes with the expectation of maintaining independently from here on. This project's changelog file describes these in detail.

查看更多 kafka 相关镜像 →
bitnami/kafka logo
bitnami/kafka
bitnami
比特纳米Kafka安全镜像是一款针对分布式流处理平台Kafka的预配置、安全加固容器镜像,集成行业最佳安全实践,涵盖漏洞扫描、最小权限原则、加密通信支持及合规性检查,旨在简化Kafka部署流程,确保数据传输与存储安全性,适用于企业级流数据处理场景,帮助用户快速搭建安全可靠的Kafka集群。
956 次收藏1亿+ 次下载
6 个月前更新
bitnamicharts/kafka logo
bitnamicharts/kafka
bitnamicharts
Bitnami为Apache Kafka提供的Helm Chart是一款预配置的Kubernetes包管理工具,旨在简化分布式流处理平台Apache Kafka在Kubernetes集群中的部署、配置与全生命周期运维管理,集成了高可用性集群设置、安全认证机制、Prometheus监控指标及自动伸缩策略等核心功能,帮助用户无需手动处理复杂的集群参数配置,即可快速搭建稳定、可扩展且符合生产级标准的Kafka服务,适用于从开发测试到大规模生产环境的各类场景。
4 次收藏1000万+ 次下载
6 个月前更新
ubuntu/kafka logo
ubuntu/kafka
Ubuntu 官方镜像
Apache Kafka 是一个分布式事件流平台,它支持高吞吐量、低延迟的实时数据流处理与传输,可广泛应用于消息传递、日志聚合、实时分析、数据集成等场景,其长期维护轨道由 Canonical 负责,以确保平台在稳定性、安全性及功能迭代方面获得持续支持,为企业级用户提供可靠的事件流处理解决方案。
60 次收藏100万+ 次下载
1 个月前更新
apache/kafka logo
apache/kafka
Apache 软件基金会镜像
Apache Kafka是一个开源的分布式流处理平台,旨在提供高吞吐量、低延迟的实时数据流传递服务,支持发布/订阅消息模式,能够持久化存储海量数据流并确保数据可靠性,具备水平扩展能力和容错机制,广泛应用于日志收集、事件驱动架构、实时数据集成及流处理系统等场景,为企业级应用提供高效、稳定的数据流传输与处理解决方案。
198 次收藏1000万+ 次下载
29 天前更新
manageiq/kafka logo
manageiq/kafka
manageiq
Kafka container for ManageIQ
1万+ 次下载
7 年前更新
adobe/kafka logo
adobe/kafka
adobe
暂无描述
5.5千+ 次下载
5 个月前更新

轩辕镜像配置手册

探索更多轩辕镜像的使用方法,找到最适合您系统的配置方式

Docker 配置

登录仓库拉取

通过 Docker 登录认证访问私有仓库

专属域名拉取

无需登录使用专属域名

K8s Containerd

Kubernetes 集群配置 Containerd

K3s

K3s 轻量级 Kubernetes 镜像加速

Dev Containers

VS Code Dev Containers 配置

Podman

Podman 容器引擎配置

Singularity/Apptainer

HPC 科学计算容器配置

其他仓库配置

ghcr、Quay、nvcr 等镜像仓库

系统配置

Linux

在 Linux 系统配置镜像服务

Windows/Mac

在 Docker Desktop 配置镜像

MacOS OrbStack

MacOS OrbStack 容器配置

Docker Compose

Docker Compose 项目配置

NAS 设备

群晖

Synology 群晖 NAS 配置

飞牛

飞牛 fnOS 系统配置镜像

绿联

绿联 NAS 系统配置镜像

威联通

QNAP 威联通 NAS 配置

极空间

极空间 NAS 系统配置服务

网络设备

爱快路由

爱快 iKuai 路由系统配置

宝塔面板

在宝塔面板一键配置镜像

需要其他帮助?请查看我们的 常见问题Docker 镜像访问常见问题解答 或 提交工单

镜像拉取常见问题

使用与功能问题

docker search 报错:专属域名下仅支持 Docker Hub 查询

docker search 报错问题

网页搜不到镜像:Docker Hub 有但轩辕镜像搜索无结果

镜像搜索不到

离线传输镜像:无法直连时用 docker save/load 迁移

离线传输镜像

Docker 插件安装错误:application/vnd.docker.plugin.v1+json

Docker 插件安装错误

WSL 下 Docker 拉取慢:网络与挂载目录影响及优化

WSL 拉取镜像慢

轩辕镜像是否安全?镜像完整性校验(digest)说明

镜像安全性

如何用轩辕镜像拉取镜像?登录方式与专属域名配置

如何拉取镜像

错误码与失败问题

manifest unknown 错误:镜像不存在或标签错误

manifest unknown 错误

TLS/SSL 证书验证失败:Docker pull 时 HTTPS 证书错误

TLS 证书验证失败

DNS 解析超时:无法解析镜像仓库地址或连接超时

DNS 解析超时

410 Gone 错误:Docker 版本过低导致协议不兼容

410 错误:版本过低

402 Payment Required 错误:流量耗尽错误提示

402 错误:流量耗尽

401 UNAUTHORIZED 错误:身份认证失败或登录信息错误

身份认证失败错误

429 Too Many Requests 错误:请求频率超出专业版限制

429 限流错误

Docker login 凭证保存错误:Cannot autolaunch D-Bus(不影响登录)

凭证保存错误

账号 / 计费 / 权限

免费版与专业版区别:功能、限额与使用场景对比

免费版与专业版区别

支持的镜像仓库:Docker Hub、GCR、GHCR、K8s 等列表

轩辕镜像支持的镜像仓库

拉取失败是否扣流量?计费规则说明

拉取失败流量计费

KYSEC 权限不够:麒麟 V10/统信 UOS 下脚本执行被拦截

KYSEC 权限错误

如何申请开具发票?(增值税普票/专票)

开具发票

如何修改网站与仓库登录密码?

修改网站和仓库密码

配置与原理类

registry-mirrors 未生效:仍访问官方仓库或报错的原因

registry-mirrors 未生效

如何去掉镜像名称中的轩辕域名前缀?(docker tag)

去掉域名前缀

如何拉取指定架构镜像?(ARM64/AMD64 等多架构)

拉取指定架构镜像

查看全部问题→

用户好评

来自真实用户的反馈,见证轩辕镜像的优质服务

用户头像

oldzhang

运维工程师

Linux服务器

5

"Docker访问体验非常流畅,大镜像也能快速完成下载。"

轩辕镜像
镜像详情
...
ches/kafka
博客公告Docker 镜像公告与技术博客
热门镜像查看热门 Docker 镜像推荐
一键安装一键安装 Docker 并配置镜像源
镜像拉取问题咨询请 提交工单,官方技术交流群:1072982923。轩辕镜像所有镜像均来源于原始仓库,本站不存储、不修改、不传播任何镜像内容。
镜像拉取问题咨询请提交工单,官方技术交流群:。轩辕镜像所有镜像均来源于原始仓库,本站不存储、不修改、不传播任何镜像内容。
官方邮箱:点击复制邮箱
©2024-2026 源码跳动
官方邮箱:点击复制邮箱Copyright © 2024-2026 杭州源码跳动科技有限公司. All rights reserved.