-
Notifications
You must be signed in to change notification settings - Fork 2
/
docker-compose.yml
42 lines (38 loc) · 1.65 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
# Based on https://github.com/confluentinc/cp-docker-images/blob/master/examples/cp-all-in-one/docker-compose.yml
version: '2.4'
services:
zookeeper:
network_mode: "host"
image: confluentinc/cp-zookeeper:6.1.1
environment:
ZOOKEEPER_CLIENT_PORT: 2181
ZOOKEEPER_TICK_TIME: 2000
kafka:
network_mode: "host"
image: confluentinc/cp-kafka:6.1.1
depends_on:
- zookeeper
environment:
KAFKA_BROKER_ID: 1
KAFKA_ZOOKEEPER_CONNECT: 'localhost: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'
KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://localhost:9092
KAFKA_AUTO_CREATE_TOPICS_ENABLE: 'true'
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
KAFKA_GROUP_INITIAL_REBALANCE_DELAY_MS: 0
schema-registry:
network_mode: "host"
image: confluentinc/cp-schema-registry:6.1.1
depends_on:
- zookeeper
- kafka
environment:
SCHEMA_REGISTRY_HOST_NAME: localhost
SCHEMA_REGISTRY_KAFKASTORE_CONNECTION_URL: 'localhost:2181'
SCHEMA_REGISTRY_LISTENERS: 'http://localhost:8081'