Skip to main content
Version: 22.2

60-Second Guide for Docker

You can only run Redpanda directly on Linux. However, you can use Docker to run Redpanda on any system supported by Docker. This 60-Second Guide helps you get started with Redpanda for development and testing.

For production or benchmarking, see Deploying for Production.

Get your cluster ready

To get a cluster ready for streaming, either run a single Docker container with Redpanda running, or run a cluster of three containers.


You can also use rpk container to run Redpanda in containers without having to interact with Docker at all.

Set up a one-node cluster

With a one-node cluster, you can test a simple implementation of Redpanda.

docker run -d --pull=always --name=redpanda-1 --rm \
-p 8081:8081 \
-p 8082:8082 \
-p 9092:9092 \
-p 9644:9644 \ \
redpanda start \
--overprovisioned \
--smp 1 \
--memory 1G \
--reserve-memory 0M \
--node-id 0 \
  • --overprovisioned - accommodates Docker resource limitations
  • --pull=always - makes sure that you're always working with the latest version

You can do some simple topic actions to start streaming. Otherwise, point your Kafka-compatible client to

Set up a three-node cluster

To test the interaction between nodes in a cluster, set up a Docker network with three containers in a cluster.

Create network and persistent volumes

Set up a bridge network, so the Redpanda instances can communicate with each other but still allow for the Kafka API to be available on the localhost. You also create the persistent volumes that let the Redpanda instances keep state during instance restarts.

docker network create -d bridge redpandanet && \
docker volume create redpanda1 && \
docker volume create redpanda2 && \
docker volume create redpanda3

Start Redpanda nodes

Start the nodes for the Redpanda cluster:

docker run -d \
--pull=always \
--name=redpanda-1 \
--hostname=redpanda-1 \
--net=redpandanet \
-p 8081:8081 \
-p 8082:8082 \
-p 9092:9092 \
-p 9644:9644 \
-v "redpanda1:/var/lib/redpanda/data" \ redpanda start \
--smp 1 \
--memory 1G \
--reserve-memory 0M \
--overprovisioned \
--node-id 0 \
--check=false \
--pandaproxy-addr INSIDE://,OUTSIDE:// \
--advertise-pandaproxy-addr INSIDE://redpanda-1:28082,OUTSIDE://localhost:8082 \
--kafka-addr INSIDE://,OUTSIDE:// \
--advertise-kafka-addr INSIDE://redpanda-1:29092,OUTSIDE://localhost:9092 \
--rpc-addr \
--advertise-rpc-addr redpanda-1:33145 && \

docker run -d \
--pull=always \
--name=redpanda-2 \
--hostname=redpanda-2 \
--net=redpandanet \
-p 8083:8083 \
-p 9093:9093 \
-v "redpanda2:/var/lib/redpanda/data" \ redpanda start \
--smp 1 \
--memory 1G \
--reserve-memory 0M \
--overprovisioned \
--node-id 1 \
--seeds "redpanda-1:33145" \
--check=false \
--pandaproxy-addr INSIDE://,OUTSIDE:// \
--advertise-pandaproxy-addr INSIDE://redpanda-2:28083,OUTSIDE://localhost:8083 \
--kafka-addr INSIDE://,OUTSIDE:// \
--advertise-kafka-addr INSIDE://redpanda-2:29093,OUTSIDE://localhost:9093 \
--rpc-addr \
--advertise-rpc-addr redpanda-2:33146 && \

docker run -d \
--pull=always \
--name=redpanda-3 \
--hostname=redpanda-3 \
--net=redpandanet \
-p 8084:8084 \
-p 9094:9094 \
-v "redpanda3:/var/lib/redpanda/data" \ redpanda start \
--smp 1 \
--memory 1G \
--reserve-memory 0M \
--overprovisioned \
--node-id 2 \
--seeds "redpanda-1:33145" \
--check=false \
--pandaproxy-addr INSIDE://,OUTSIDE:// \
--advertise-pandaproxy-addr INSIDE://redpanda-3:28084,OUTSIDE://localhost:8084 \
--kafka-addr INSIDE://,OUTSIDE:// \
--advertise-kafka-addr INSIDE://redpanda-3:29094,OUTSIDE://localhost:9094 \
--rpc-addr \
--advertise-rpc-addr redpanda-3:33147

Now you can run rpk on one of the containers to interact with the cluster:

docker exec -it redpanda-1 rpk cluster info

Or as a separate container in the same network:

docker run --net redpandanet cluster info --brokers=redpanda-1:29092

The output of the status command looks similar to the following:

0* redpanda-1 29092
1 redpanda-2 29093
2 redpanda-3 29094

Bring up a docker-compose file

You can try out different Docker configuration parameters with a docker-compose file.

  1. Save this content as docker-compose.yml:
version: '3.7'
# NOTE: Please use the latest version here!
container_name: redpanda-1
- redpanda
- start
- --smp
- '1'
- --reserve-memory
- 0M
- --overprovisioned
- --node-id
- '0'
- --kafka-addr
- --advertise-kafka-addr
- PLAINTEXT://redpanda:29092,OUTSIDE://localhost:9092
- --pandaproxy-addr
- --advertise-pandaproxy-addr
- PLAINTEXT://redpanda:28082,OUTSIDE://localhost:8082
- 8081:8081
- 8082:8082
- 9092:9092
- 28082:28082
- 29092:29092
  1. In the directory where the file is saved, run:

    docker-compose up -d

To change the parameters, edit the docker-compose file, and run the command again.

Start streaming

Use rpk to run commands. rpk is a CLI tool you can use to work with your Redpanda nodes. See rpk Commands. Here are some sample commands to produce and consume streams:

Create a topic called twitch_chat:

docker exec -it redpanda-1 \
rpk topic create twitch_chat --brokers=localhost:9092

Produce messages to the topic:

docker exec -it redpanda-1 \
rpk topic produce twitch_chat --brokers=localhost:9092

Type text into the topic, and click Ctrl + D to separate between messages.

Click Ctrl + C to exit the produce command.

Consume (read) the messages in the topic:

docker exec -it redpanda-1 \
rpk topic consume twitch_chat --brokers=localhost:9092

Each message is shown with its metadata, like this:

"message": "How do you stream with Redpanda?\n",
"partition": 0,
"offset": 1,
"timestamp": "2021-02-10T15:52:35.251+02:00"

Delete the containers

When you're finished with the cluster, shut down and delete the containers. The following commands show how to do this for a three-node cluster.

docker stop redpanda-1 redpanda-2 redpanda-3 && \
docker rm redpanda-1 redpanda-2 redpanda-3

If you set up volumes and a network, delete them:

docker volume rm redpanda1 redpanda2 redpanda3 && \
docker network rm redpandanet