ChrisRTech
ChrisRTech

Reputation: 577

Run apache pulsar using docker-compose

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:

Upvotes: 6

Views: 4633

Answers (1)

Sergii Zhevzhyk
Sergii Zhevzhyk

Reputation: 4202

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

Upvotes: 7

Related Questions