docker-compose 提供了基于docker编排功能

  1. 创建一个空文件夹

    1
    2
    mkdir docker-compose-go
    cd docker-compose-go
  2. 创建docker-compose.yml文件,文件内容如下

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    version: "2.1"
    services:
    jobmanager:
    image: flink
    expose:
    - "6123"
    ports:
    - "8081:8081"
    command: jobmanager
    environment:
    - JOB_MANAGER_RPC_ADDRESS=jobmanager
    taskmanager:
    image: flink
    expose:
    - "6121"
    - "6122"
    depends_on:
    - jobmanager
    command: taskmanager
    links:
    - "jobmanager:jobmanager"
    environment:
    - JOB_MANAGER_RPC_ADDRESS=jobmanager
  3. 运行,-d是后台运行

    1
    docker-compose up -d
  4. 访问localhost:8081