编写docker-compose.yml
参照:https://github.com/docker-flink/examples/blob/master/docker-compose.yml
version: "2.1"
services:
jobmanager:
image: flink:1.14.4-scala_2.11
expose:
- "6123"
ports:
- "18081:8081"
command: jobmanager
environment:
- JOB_MANAGER_RPC_ADDRESS=jobmanager
taskmanager:
image: flink:1.14.4-scala_2.11
expose:
- "6121"
- "6122"
depends_on:
- jobmanager
command: taskmanager
links:
- "jobmanager:jobmanager"
environment:
- JOB_MANAGER_RPC_ADDRESS=jobmanager
scale: 2 #指定TaskManager的数量
在docker-compose.yml所有目录执行以下命令:
docker-compose up -d
执行过程:
[+] Running 14/14
✔ taskmanager 12 layers [⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿] 0B/0B Pulled 129.9s
✔ e756f3fdd6a3 Pull complete 17.7s
✔ bf168a674899 Pull complete 8.6s
✔ e604223835cc Pull complete 19.0s
✔ b879d05afe7d Pull complete 17.7s
✔ a54258f91250 Pull complete 20.7s
✔ c395a90ab0cf Pull complete 30.3s
✔ b79b6485357a Pull complete 22.8s
✔ 7a587b6ad6b3 Pull complete 28.5s
✔ 9021ca31d420 Pull complete 26.8s
✔ b215a7eba672 Pull complete 32.2s
✔ de1d611fa80f Pull complete 107.8s
✔ 9354c4dc24c1 Pull complete 35.4s
✔ jobmanager Pulled 129.9s
[+] Running 3/4
- Network flinkdata_default Created 1.5s
✔ Container flinkdata-jobmanager-1 Started 0.8s
✔ Container flinkdata-taskmanager-2 Started 1.2s
✔ Container flinkdata-taskmanager-1 Started 0.8s
控制台查看: