-
Notifications
You must be signed in to change notification settings - Fork 4
/
docker-compose.yml
51 lines (46 loc) · 1.86 KB
/
docker-compose.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# Based on https://github.com/confluentinc/cp-docker-images/blob/master/examples/cp-all-in-one/docker-compose.yml
version: '3'
services:
zookeeper:
image: confluentinc/cp-zookeeper:5.1.3
hostname: zookeeper
container_name: zookeeper
ports:
- 2181:2181
environment:
ZOOKEEPER_CLIENT_PORT: 2181
ZOOKEEPER_TICK_TIME: 2000
kafka:
image: confluentinc/cp-kafka:5.1.3
hostname: kafka
container_name: kafka
depends_on:
- zookeeper
ports:
- 9093:9093
- 9092:9092
environment:
KAFKA_BROKER_ID: 1
KAFKA_ZOOKEEPER_CONNECT: 'zookeeper:2181'
# We need zookeeper to advertise two different urls since the broker has to be reachable
# from two different environments (once from inside the docker network and once from the host)
# However it is neither possible to advertise two listeners but only configure one via KAFKA_LISTENERS
# nor is it possible to advertise two listeners with the same protocol but different ports and hostnames since
# they are still considered to have the same name.
# We can do nothing about the former case but we can trick kafka with a custom protocol in the latter case.
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: 'PLAINTEXT:PLAINTEXT,LOCAL:PLAINTEXT'
KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://kafka:9093,LOCAL://localhost:9092
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
KAFKA_GROUP_INITIAL_REBALANCE_DELAY_MS: 0
schema_registry:
image: confluentinc/cp-schema-registry:5.2.2
container_name: schema_registry
environment:
- SCHEMA_REGISTRY_KAFKASTORE_CONNECTION_URL=zookeeper:2181
- SCHEMA_REGISTRY_HOST_NAME=schema-registry
- SCHEMA_REGISTRY_LISTENERS=http://0.0.0.0:8081
- SCHEMA_REGISTRY_KAFKASTORE_BOOTSTRAP_SERVERS=PLAINTEXT://kafka:9093
depends_on:
- kafka
ports:
- 8081:8081