-
Notifications
You must be signed in to change notification settings - Fork 4
/
docker-compose.yml
67 lines (64 loc) · 2.61 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# Based on https://github.com/confluentinc/cp-docker-images/blob/master/examples/cp-all-in-one/docker-compose.yml
version: '3'
services:
zookeeper:
build:
context: .
dockerfile: kafka.Dockerfile
command: >
bash -c "/init.sh
&& confluent-community/bin/zookeeper-server-start confluent-community/etc/kafka/zookeeper.properties"
hostname: zookeeper
container_name: zookeeper
ports:
- 2181:2181
environment:
CONFIG_PATH: 'confluent-community/etc/kafka/zookeeper.properties'
ZOOKEEPER_CLIENT_PORT: 2181
kafka:
build:
context: .
dockerfile: kafka.Dockerfile
hostname: kafka
container_name: kafka
command: >
bash -c "/wait-for-it.sh zookeeper:2181 -t 60
&& /init.sh
&& confluent-community/bin/kafka-server-start confluent-community/etc/kafka/server.properties"
depends_on:
- zookeeper
ports:
- 9092:9092
- 9093:9093
environment:
CONFIG_PATH: 'confluent-community/etc/kafka/server.properties'
KAFKA_ZOOKEEPER_CONNECT: 'zookeeper:2181'
KAFKA_AUTO_CREATE_TOPICS_ENABLE: 'False'
# 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: 'LOCAL:PLAINTEXT,PLAINTEXT:PLAINTEXT'
KAFKA_LISTENERS: 'LOCAL://:9092,PLAINTEXT://kafka:9093'
KAFKA_ADVERTISED_LISTENERS: 'LOCAL://127.0.0.1:9092,PLAINTEXT://kafka:9093'
schema_registry:
build:
context: .
dockerfile: kafka.Dockerfile
container_name: schema_registry
command: >
bash -c "/wait-for-it.sh kafka:9093 -t 60
&& /init.sh
&& confluent-community/bin/schema-registry-start confluent-community/etc/schema-registry/schema-registry.properties"
environment:
CONFIG_PATH: 'confluent-community/etc/schema-registry/schema-registry.properties'
SCHEMAREGISTRY_KAFKASTORE_CONNECTION_URL: zookeeper:2181
SCHEMAREGISTRY_HOST_NAME: schema-registry
SCHEMAREGISTRY_LISTENERS: http://0.0.0.0:8081
SCHEMAREGISTRY_KAFKASTORE_BOOTSTRAP_SERVERS: PLAINTEXT://kafka:9093
depends_on:
- kafka
ports:
- 8081:8081