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 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191
| version: '2' # 定义版本,不指定默认为版本 1,新版本功能更多 services: # 容器 zoo1: image: zookeeper:3.4.14 restart: always container_name: zoo1 hostname: zoo1 ports: - "2181:2181" environment: ZOO_MY_ID: 1 ZOO_SERVERS: server.1=zoo1:2888:3888 server.2=zoo2:2888:3888 server.3=zoo3:2888:3888 networks: mynet: #ipv4_address: 172.20.0.2 zoo2: image: zookeeper:3.4.14 restart: always container_name: zoo2 hostname: zoo2 ports: - "2182:2181" environment: ZOO_MY_ID: 2 ZOO_SERVERS: server.1=zoo1:2888:3888 server.2=zoo2:2888:3888 server.3=zoo3:2888:3888 networks: mynet: #ipv4_address: 172.20.0.3 zoo3: image: zookeeper:3.4.14 restart: always container_name: zoo3 hostname: zoo3 ports: - "2183:2181" environment: ZOO_MY_ID: 3 ZOO_SERVERS: server.1=zoo1:2888:3888 server.2=zoo2:2888:3888 server.3=zoo3:2888:3888 networks: mynet: #ipv4_address: 172.20.0.4 broker1: image: wurstmeister/kafka:0.8.2.1 restart: always container_name: broker1 ports: - "9091:9092" depends_on: - zoo1 - zoo2 - zoo3 hostname: '{{.Node.Hostname}}' environment: KAFKA_BROKER_ID: 1 KAFKA_ADVERTISED_HOST_NAME: broker1 KAFKA_ADVERTISED_PORT: 9092 KAFKA_HOST_NAME: broker1 KAFKA_ZOOKEEPER_CONNECT: zoo1:2181,zoo2:2182,zoo3:2183 KAFKA_LISTENERS: PLAINTEXT://broker1:9092 KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://broker1:9092 volumes: - /Users/chris-cai/Documents/docker/runningFile/brocker1/docker.sock:/var/run/docker.sock networks: mynet: #ipv4_address: 172.20.0.5 broker2: image: wurstmeister/kafka:0.8.2.1 restart: always container_name: broker2 ports: - "9092:9092" depends_on: - zoo1 - zoo2 - zoo3 hostname: '{{.Node.Hostname}}' environment: KAFKA_BROKER_ID: 2 KAFKA_ADVERTISED_HOST_NAME: broker2 KAFKA_ADVERTISED_PORT: 9092 KAFKA_HOST_NAME: broker2 KAFKA_ZOOKEEPER_CONNECT: zoo1:2181,zoo2:2182,zoo3:2183 KAFKA_LISTENERS: PLAINTEXT://broker2:9092 KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://broker2:9092 volumes: - /Users/chris-cai/Documents/docker/runningFile/brocker2/docker.sock:/var/run/docker.sock networks: mynet: #ipv4_address: 172.20.0.6 broker3: image: wurstmeister/kafka:0.8.2.1 restart: always container_name: broker3 ports: - "9093:9092" depends_on: - zoo1 - zoo2 - zoo3 hostname: '{{.Node.Hostname}}' environment: KAFKA_BROKER_ID: 3 KAFKA_ADVERTISED_HOST_NAME: broker3 KAFKA_ADVERTISED_PORT: 9092 KAFKA_HOST_NAME: broker3 KAFKA_ZOOKEEPER_CONNECT: zoo1:2181,zoo2:2182,zoo3:2183 KAFKA_LISTENERS: PLAINTEXT://broker3:9092 KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://broker3:9092 volumes: - /Users/chris-cai/Documents/docker/runningFile/brocker3/docker.sock:/var/run/docker.sock networks: mynet: #ipv4_address: 172.20.0.7 kafka-manager: image: sheepkiller/kafka-manager restart: always depends_on: - zoo1 - zoo2 - zoo3 - broker1 - broker2 - broker3 environment: ZK_HOSTS: zoo1:2181,zoo2:2182,zoo3:2183 ports: - "9000:9000" container_name: kafka-manager networks: mynet: kafka-offset-monitor: image: 564239555/kafkaoffsetmonitor volumes: - /Users/chris-cai/Documents/docker/runningFile/kafkaoffsetmonitor/conf:/kafkaoffsetmonitor ports: - "8089:8089" depends_on: - zoo1 - zoo2 - zoo3 - broker1 - broker2 - broker3 environment: ZK_HOSTS: zoo1:2181,zoo2:2182,zoo3:2183 KAFKA_BROKERS: broker1:9091,broker2:9092,broker3:9093 REFRESH_SECENDS: 10 RETAIN_DAYS: 2 container_name: kafka-monitor mysql1: image: mysql:5.7.29 restart: always environment: MYSQL_ROOT_PASSWORD: 123456 MYSQL_USER: test MYSQL_PASS: 123456 volumes: - "/Users/chris-cai/Documents/docker/runningFile/mysql/db:/var/lib/mysql" - "/Users/chris-cai/Documents/docker/runningFile/mysql/conf/my.cnf:/etc/my.cnf" - "/Users/chris-cai/Documents/docker/runningFile/mysql/init:/docker-entrypoint-initdb.d/" ports: - 3306:3306 networks: mynet: #ipv4_address: 172.20.0.10 container_name: mysql1 nginx: restart: always image: nginx:stable ports: - 8080:80 - 80:80 - 443:443 volumes: - /Users/chris-cai/Documents/docker/runningFile/nginx/conf.d:/etc/nginx/conf.d - /Users/chris-cai/Documents/docker/runningFile/nginx/log:/var/log/nginx - /Users/chris-cai/Documents/docker/runningFile/nginx/www:/var/www jenkins: image: 'jenkins/jenkins:2.60.3' # 镜像 container_name: jenkins # 容器名称 restart: always # 同 --restart 参数 ports: # 端口映射,同 -p 参数,本地端口:容器端口 - '8080:8080' - '50000:50000' volumes: # 数据卷,本地文件夹:容器文件夹 - '/c/Users/01390559/dockerTmp/jenkins:/var/jenkins_home' environment: TZ: Asia/Shanghai networks: mynet: driver: bridge
|