Jump to content

Connect Leeroopedia MCP: Equip your AI agents to search best practices, build plans, verify code, diagnose failures, and look up hyperparameter defaults.

Implementation:Apache Kafka Docker Buildx Build Push

From Leeroopedia


Knowledge Sources
Domains Release_Engineering, Containerization
Last Updated 2026-02-09 12:00 GMT

Overview

Concrete tool for building and pushing multi-architecture Docker images provided by the Kafka docker_release module.

Description

The build_push function orchestrates multi-arch Docker image builds. It creates a Buildx builder, constructs the docker buildx build command with platform flags, Kafka URL, and push options, then executes via build_docker_image_runner. The builder is cleaned up in a finally block.

Usage

Use via docker_release.py CLI when publishing official release Docker images.

Code Reference

Source Location

  • Repository: Apache Kafka
  • File: docker/docker_release.py
  • Lines: L43-57

Signature

def build_push(image, kafka_url, image_type):
    """
    Builds and pushes multi-arch Docker image.
    Creates builder, builds for linux/amd64,linux/arm64,
    pushes to registry, then removes builder.

    Args:
        image: Full image name with registry and tag (e.g., "apache/kafka:3.7.0")
        kafka_url: URL to download Kafka binary tarball
        image_type: "jvm" or "native"
    """

Import

from common import build_docker_image_runner
# CLI: python docker_release.py image -u kafka_url

I/O Contract

Inputs

Name Type Required Description
image str Yes Full image name with registry/tag
kafka_url str Yes URL to download Kafka binary
image_type str Yes "jvm" or "native"

Outputs

Name Type Description
Multi-arch image Docker manifest Image pushed to registry for amd64 and arm64

Usage Examples

Build and Push Release Image

python docker/docker_release.py apache/kafka:3.7.0 \
  -u https://downloads.apache.org/kafka/3.7.0/kafka_2.13-3.7.0.tgz

# For native image
python docker/docker_release.py apache/kafka-native:3.7.0 \
  -type native \
  -u https://downloads.apache.org/kafka/3.7.0/kafka_2.13-3.7.0.tgz

Related Pages

Implements Principle

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment