Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Run pulsar in docker container is failing with "Pulsar requires Java 17 or later" #23891

Open
2 of 3 tasks
unreal91 opened this issue Jan 24, 2025 · 1 comment
Open
2 of 3 tasks
Labels
type/bug The PR fixed a bug or issue reported a bug

Comments

@unreal91
Copy link

Search before asking

  • I searched in the issues and found nothing similar.

Read release policy

  • I understand that unsupported versions don't get bug fixes. I will attempt to reproduce the issue on a supported version of Pulsar client and Pulsar broker.

Version

Running on docker in Mac OS Version 15.2
Version: 27.4.0
Context: desktop-linux

Pulsar versions 3.3.2, 4.0.2

Minimal reproduce step

When we run command
docker run -it -p 6650:6650 -p 8080:8080 --mount source=pulsardata,target=/pulsar/data --mount source=pulsarconf,target=/pulsar/conf apachepulsar/pulsar:4.0.2 bin/pulsar standalone

Error is as below:

Error: Pulsar requires Java 17 or later.

Below docker compose also fails

services:
  zookeeper:
    image: apachepulsar/pulsar:latest
    container_name: zookeeper
    networks:
      - pulsar
    volumes:
      - ./data/zookeeper:/pulsar/data/zookeeper
    environment:
      - metadataStoreUrl=zk:zookeeper:2181
      - PULSAR_MEM=-Xms256m -Xmx256m -XX:MaxDirectMemorySize=256m
    command: >
      bash -c "bin/apply-config-from-env.py conf/zookeeper.conf && \
             bin/generate-zookeeper-config.sh conf/zookeeper.conf && \
             exec bin/pulsar zookeeper"
    healthcheck:
      test: ["CMD", "bin/pulsar-zookeeper-ruok.sh"]
      interval: 10s
      timeout: 5s
      retries: 30

  pulsar-init:
    container_name: pulsar-init
    hostname: pulsar-init
    image: apachepulsar/pulsar:latest
    networks:
      - pulsar
    command: >
      bash -c "bin/pulsar initialize-cluster-metadata \
      --cluster cluster-a \
      --zookeeper zookeeper:2181 \
      --configuration-store zookeeper:2181 \
      --web-service-url http://broker:8080 \
      --broker-service-url pulsar://broker:6650"
    depends_on:
      zookeeper:
        condition: service_healthy

  bookie:
    image: apachepulsar/pulsar:latest
    container_name: bookie
    restart: on-failure
    networks:
      - pulsar
    environment:
      - clusterName=cluster-a
      - zkServers=zookeeper:2181
      - metadataServiceUri=metadata-store:zk:zookeeper:2181
      # otherwise every time we run docker compose uo or down we fail to start due to Cookie
      # See: https://github.com/apache/bookkeeper/blob/405e72acf42bb1104296447ea8840d805094c787/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/Cookie.java#L57-68
      - advertisedAddress=bookie
      - BOOKIE_MEM=-Xms512m -Xmx512m -XX:MaxDirectMemorySize=256m
    depends_on:
      zookeeper:
        condition: service_healthy
      pulsar-init:
        condition: service_completed_successfully
    # Map the local directory to the container to avoid bookie startup failure due to insufficient container disks.
    volumes:
      - ./data/bookkeeper:/pulsar/data/bookkeeper
    command: bash -c "bin/apply-config-from-env.py conf/bookkeeper.conf && exec bin/pulsar bookie"

  broker:
    image: apachepulsar/pulsar:latest
    container_name: broker
    hostname: broker
    restart: on-failure
    networks:
      - pulsar
    environment:
      - metadataStoreUrl=zk:zookeeper:2181
      - zookeeperServers=zookeeper:2181
      - clusterName=cluster-a
      - managedLedgerDefaultEnsembleSize=1
      - managedLedgerDefaultWriteQuorum=1
      - managedLedgerDefaultAckQuorum=1
      - advertisedAddress=broker
      - advertisedListeners=external:pulsar://127.0.0.1:6650
      - PULSAR_MEM=-Xms512m -Xmx512m -XX:MaxDirectMemorySize=256m
    depends_on:
      zookeeper:
        condition: service_healthy
      bookie:
        condition: service_started
    ports:
      - "6650:6650"
      - "8080:8080"
    command: bash -c "bin/apply-config-from-env.py conf/broker.conf && exec bin/pulsar broker"

networks:
  pulsar:
    external: true
    name: web-admin_default

What did you expect to see?

Run pulsar as normal.

What did you see instead?

Error is as below:
Error: Pulsar requires Java 17 or later.

Anything else?

No response

Are you willing to submit a PR?

  • I'm willing to submit a PR!
@unreal91 unreal91 added the type/bug The PR fixed a bug or issue reported a bug label Jan 24, 2025
@lhotari
Copy link
Member

lhotari commented Jan 27, 2025

Version

Running on docker in Mac OS Version 15.2 Version: 27.4.0 Context: desktop-linux

Pulsar versions 3.3.2, 4.0.2

Minimal reproduce step

When we run command docker run -it -p 6650:6650 -p 8080:8080 --mount source=pulsardata,target=/pulsar/data --mount source=pulsarconf,target=/pulsar/conf apachepulsar/pulsar:4.0.2 bin/pulsar standalone

@unreal91 I'm not able to reproduce with these instructions. It's some issue in your environment. Have you had a chance to try on a different computer?

What happens when you run this command?

docker run --rm apachepulsar/pulsar:4.0.2 java -version

Please ensure that Digest: sha256:8c0729055f56a8e30dec5d3cc7f85bd1aea9485858e95da57b96b9e43833b910 is what you see when you run docker pull apachepulsar/pulsar:4.0.2 (or check the Id with docker inspect apachepulsar/pulsar:4.0.2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/bug The PR fixed a bug or issue reported a bug
Projects
None yet
Development

No branches or pull requests

2 participants