Run apache pulsar using docker-compose
Asked Answered
S

1

6

I am able to run Apache Pulsar using this docker command:

docker run -it \
  -p 6650:6650 \
  -p 8080:8080 \
  --mount source=pulsardata,target=/pulsar/data \
  --mount source=pulsarconf,target=/pulsar/conf \
  apachepulsar/pulsar:2.6.0 \
  bin/pulsar standalone

I am trying to convert this to docker-compose and I use the docker-compose.yml file below. When I run the command:

docker-compose up

I get the error:
Attaching to pulsar pulsar | Error: Could not find or load main class " pulsar exited with code 1

What am I doing wrong here? Thanks in advance.

version: '3.1'
services:
  standalone:
    image: apachepulsar/pulsar:2.6.0
    container_name: pulsar
    ports:
      - 8080:8080
      - 6650:6650
    environment:
      - PULSAR_MEM=" -Xms512m -Xmx512m -XX:MaxDirectMemorySize=1g"
    volumes:
      - pulsardata:/pulsar/data
      - pulsarconf:/pulsar/conf
    command: /bin/bash -c "bin/pulsar standalone"
volumes:
  pulsardata:
  pulsarconf:
Supranational answered 22/6, 2020 at 17:55 Comment(0)
C
7

The issue is with the env variable. It should work if you specify it in the following way:

version: '3.1'
services:
  standalone:
    image: apachepulsar/pulsar:2.6.0
    ports:
      - 8080:8080
      - 6650:6650
    environment:
      PULSAR_MEM: " -Xms512m -Xmx512m -XX:MaxDirectMemorySize=1g"    
    command: bin/pulsar standalone
    # ... other parameters
Corvin answered 24/6, 2020 at 19:14 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.