docker-compose.yml

  1. version: '3'
  2. services:
  3. # ref: https://hub.docker.com/r/wurstmeister/kafka
  4. zookeeper:
  5. image: zookeeper
  6. hostname: zookeeper
  7. container_name: zookeeper
  8. ports:
  9. - 2181:2181
  10. volumes:
  11. - ~/install/tools/zookeeper/data:/data
  12. - ~/install/tools/zookeeper/datalog:/datalog
  13. kafka:
  14. image: wurstmeister/kafka
  15. container_name: kafka
  16. hostname: kafka
  17. ports:
  18. - "9092:9092"
  19. links:
  20. - zookeeper
  21. environment:
  22. KAFKA_ADVERTISED_HOST_NAME: 192.168.1.5
  23. KAFKA_ADVERTISED_PORT: 9092
  24. KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
  25. volumes:
  26. - ./data/logs:/kafka
  27. - /var/run/docker.sock:/var/run/docker.sock
  28. ## 挂载位置(kafka镜像和宿主机器之间时间保持一直)
  29. - /etc/localtime:/etc/localtime
  30. kafka-manager:
  31. image: sheepkiller/kafka-manager
  32. container_name: kafka-manager
  33. ports:
  34. - 9000:9000
  35. environment:
  36. ZK_HOSTS: zookeeper:2181