Deploy a cluster on Docker
To deploy a Pulsar cluster on Docker, complete the following steps:
- Deploy a ZooKeeper cluster (optional)
- Initialize cluster metadata
- Deploy a BookKeeper cluster
- Deploy one or more Pulsar brokers
Prepare​
To run Pulsar on Docker, you need to create a container for each Pulsar component: ZooKeeper, BookKeeper and broker. You can pull the images of ZooKeeper and BookKeeper separately on Docker Hub, and pull a Pulsar image for the broker. You can also pull only one Pulsar image and create three containers with this image. This tutorial takes the second option as an example.
Pull a Pulsar image​
You can pull a Pulsar image from Docker Hub with the following command.
docker pull apachepulsar/pulsar-all:latest
Create three containers​
Create containers for ZooKeeper, BookKeeper and broker. In this example, they are named as zookeeper
, bookkeeper
and broker
respectively. You can name them as you want with the --name
flag. By default, the container names are created randomly.
docker run -it --name bookkeeper apachepulsar/pulsar-all:latest /bin/bash
docker run -it --name zookeeper apachepulsar/pulsar-all:latest /bin/bash
docker run -it --name broker apachepulsar/pulsar-all:latest /bin/bash