version: '3' services: zookeeper: image: wurstmeister/zookeeper ports: - 2182:2181 kafka: image: wurstmeister/kafka ports: - 9092:9092 environment: KAFKA_BROKER_ID: 0 KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://172.26.45.217:9092 # 物理机地址 KAFKA_CREATE_TOPICS: "go-chat-message:2:0" # kafka启动后初始化一个有2个partition(分区)0个副本名叫go-chat-message的topic KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181 KAFKA_LISTENERS: PLAINTEXT://0.0.0.0:9092 depends_on: - zookeeper kafka-manager: image: hlebalbau/kafka-manager ports: - "9000:9000" environment: ZK_HOSTS: zookeeper:2181 mysql8: image: mysql:8.0 container_name: mysql8 restart: always environment: TZ: Asia/Shanghai MYSQL_ROOT_PASSWORD: Meetingyou0)) MYSQL_DATABASE: go-chat-message MYSQL_USER: root MYSQL_PASSWORD: Meetingyou0)) ports: - 3306:3306 command: # 将mysql8.0默认密码策略 修改为 原先 策略 (mysql8.0对其默认策略做了更改 会导致密码无法匹配) --default-authentication-plugin=mysql_native_password --character-set-server=utf8mb4 --collation-server=utf8mb4_general_ci --explicit_defaults_for_timestamp=true --lower_case_table_names=1 nginx: image: nginx:latest container_name: nginx volumes: - ./nginx.conf:/etc/nginx/nginx.conf ports: - 80:80 links: - gochat - gochat1 depends_on: - gochat - gochat1 gochat: image: konenet/gochat:1.0 container_name: gochat restart: always ports: - 8888:8888 links: - mysql8 - kafka depends_on: - mysql8 - kafka gochat1: image: konenet/gochat:1.0 restart: always container_name: gochat1 links: - mysql8 - kafka depends_on: - mysql8 - kafka