apache/kafka · error · SystemError

Docker image push failed

Error message

Docker image push failed

What it means

docker/docker_release.py:build_push wraps the multi-arch buildx push (`--platform linux/amd64,linux/arm64 --tag ... --push`) in a bare except and re-raises SystemError('Docker image push failed'). remove_builder() runs in `finally`. Like error 115 the underlying cause is discarded by the bare except.

Solutions

  1. `docker login` with an account that has push rights to the target namespace, then re-run.
  2. Verify the --tag target namespace/repo is correct and that the account is authorized.
  3. Re-run the buildx command without --push first to confirm the build itself succeeds on both linux/amd64 and linux/arm64.
  4. Check registry quota/rate limits; retry after a backoff if it is a transient push error.

Example fix

# before
$ python3 docker/docker_release.py
... -> SystemError: Docker image push failed  (cause hidden)

# debug
$ docker login
$ docker buildx build -f <DF> --build-arg kafka_url=<url> --build-arg build_date=$(date +%F) \
      --platform linux/amd64,linux/arm64 --tag <image> <DIR>
# build-only run surfaces real stderr without attempting the push
Defensive patterns

Strategy: try-catch

Validate before calling

import subprocess
logged_in = subprocess.run(["docker","logout"], capture_output=True).returncode == 0
# better: check `docker system info` for registry auth before pushing
if subprocess.run(["docker","login","--help"], capture_output=True).returncode != 0:
    raise SystemExit("docker login required before push")

Type guard

null

Try / catch

try:
    build_push(image, kafka_url, image_type)
except SystemError:
    print("push failed; run `docker login` and re-try", file=sys.stderr)
    raise

Prevention

When it happens

Trigger: The `docker buildx build ... --push` step fails - most commonly due to registry authentication, permissions on the target tag, network issues during layer push, or a build failure (which also surfaces here because build and push are one command).

Common situations: Not logged in to Docker Hub (`docker login`); pushing to a tag/namespace you lack push rights for; build failure on one of the two platforms; expired registry token.

Related errors


AI-assisted analysis of apache/kafka@996fb4585a (2026-08-11). Data as JSON: /api/errors/af51e3f42b6400a9. Report an issue: GitHub.

Appendix: source

Thrown at docker/docker_release.py:49

        docker_release <image> --kafka-url <kafka_url> --image-type <type>

        This command will build the multiarch image of type <type> (jvm by default),
        named <image> using <kafka_url> to download kafka and push it to the docker image name <image> provided.
        Make sure image is in the format of <registry>/<namespace>/<image_name>:<image_tag>.
"""

from datetime import date
import argparse

from common import execute, build_docker_image_runner

def build_push(image, kafka_url, image_type):
    try:
        create_builder()
        build_docker_image_runner(f"docker buildx build -f $DOCKER_FILE --build-arg kafka_url={kafka_url} --build-arg build_date={date.today()} --push \
              --platform linux/amd64,linux/arm64 --tag {image} $DOCKER_DIR", image_type)
    except:
        raise SystemError("Docker image push failed")
    finally:
        remove_builder()

def create_builder():
    execute(["docker", "buildx", "create", "--name", "kafka-builder", "--use"])

def remove_builder():
    execute(["docker", "buildx", "rm", "kafka-builder"])

if __name__ == "__main__":
    print("\
          This script will build and push docker images of apache kafka.\n \
          Please ensure that image has been sanity tested before pushing the image. \n \
          Please ensure you are logged in the docker registry that you are trying to push to.")
    parser = argparse.ArgumentParser()
    parser.add_argument("image", help="Dockerhub image that you want to push to (in the format <registry>/<namespace>/<image_name>:<image_tag>)")
    parser.add_argument("--image-type", "-type", choices=["jvm", "native"], default="jvm", dest="image_type", help="Image type you want to build")
    parser.add_argument("--kafka-url", "-u", dest="kafka_url", help="Kafka url to be used to download kafka binary tarball in the docker image")

View on GitHub (pinned to 996fb4585a)