docker-compose.yml
1.96 KB
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
version: '3.9'
services:
zookeeper-kafka:
image: confluentinc/cp-zookeeper:latest
ports:
- '2181:2181'
environment:
ZOOKEEPER_CLIENT_PORT: 2181
ZOOKEEPER_TICK_TIME: 2000
healthcheck:
# fake healthcheck just to have one to simplify status check
test: ['CMD', 'date']
interval: 10s
timeout: 5s
retries: 5
# docs at: https://registry.hub.docker.com/r/wurstmeister/kafka
kafka:
image: wurstmeister/kafka:latest
restart: always
depends_on:
- zookeeper-kafka
ports:
- '9092:9092'
volumes:
# It's the only way to deal with Kafka non-static exposed ports to host
# See: https://github.com/wurstmeister/kafka-docker/blob/master/start-kafka.sh#L65-L76
- /var/run/docker.sock:/var/run/docker.sock
environment:
KAFKA_BROKER_ID: 1
KAFKA_ZOOKEEPER_CONNECT: 'zookeeper-kafka:2181'
PORT_COMMAND: 'docker port $$(hostname) 9092/tcp | cut -d: -f2'
KAFKA_LISTENERS: 'LISTENER_INTERNAL://kafka:29092,LISTENER_HOST://:9092'
KAFKA_ADVERTISED_LISTENERS: LISTENER_INTERNAL://kafka:29092,LISTENER_HOST://localhost:_{PORT_COMMAND}
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: LISTENER_INTERNAL:PLAINTEXT,LISTENER_HOST:PLAINTEXT
KAFKA_INTER_BROKER_LISTENER_NAME: LISTENER_INTERNAL
KAFKA_AUTO_CREATE_TOPICS_ENABLE: 'true'
KAFKA_CREATE_TOPICS: 'test:1:1'
healthcheck:
test:
[
'CMD',
'/opt/kafka/bin/kafka-topics.sh',
'--list',
'--bootstrap-server',
'kafka:29092',
]
interval: 10s
timeout: 5s
retries: 5
kafka-ui:
container_name: kafka-ui
image: provectuslabs/kafka-ui:latest
ports:
- "8080:8080"
depends_on:
- zookeeper-kafka
- kafka
environment:
KAFKA_CLUSTERS_0_NAME: local
KAFKA_CLUSTERS_0_BOOTSTRAPSERVERS: kafka:29092
KAFKA_CLUSTERS_0_ZOOKEEPER: zookeeper-kafka:2181
KAFKA_CLUSTERS_0_JMXPORT: 9997