参考 官方文档
https://ci.apache.org/projects/flink/flink-docs-release-1.11/zh/ops/deployment/docker.html

注意要点:

  1. 可以指定flink版本号及scala版本号

直接点,具体配置等说明看官方文档
docker-compose.yml

  1. version: "2.2"
  2. services:
  3. jobmanager:
  4. image: flink:1.11.2-scala_2.11
  5. ports:
  6. - "8081:8081"
  7. command: jobmanager
  8. container_name: jobmanager
  9. volumes:
  10. - ./flink/job/artifacts:/opt/flink/usrlib
  11. environment:
  12. - |
  13. FLINK_PROPERTIES=
  14. jobmanager.rpc.address: jobmanager
  15. parallelism.default: 2
  16. taskmanager:
  17. image: flink:1.11.2-scala_2.11
  18. depends_on:
  19. - jobmanager
  20. command: taskmanager
  21. container_name: taskmanager
  22. scale: 1
  23. volumes:
  24. - ./flink/job/artifacts:/opt/flink/usrlib
  25. environment:
  26. - |
  27. FLINK_PROPERTIES=
  28. jobmanager.rpc.address: jobmanager
  29. taskmanager.numberOfTaskSlots: 2
  30. parallelism.default: 2