version: '3.7'

networks:
  vinet:
    external: true

services:
  hbbs: # RustDesk ID/Rendezvous 服务器
    container_name: rustdesk-hbbs
    hostname: hbbs
    ports:
      - 6015:21115           # 用于 NAT 类型测试的 TCP
      - 6016:21116           # TCP打孔
      - 6016:21116/udp       # UDP心跳/ID服务器
      - 6018:21118           # 如果要运行web客户端，则使用TCP进行web套接字
    #docker pull rustdesk/rustdesk-server:1.1.14
    #image: rustdesk/rustdesk-server:latest
    image: rustdesk/rustdesk-server:1.1.14
    command: hbbs
    volumes:
      - $HOME/run/docker_map/rustdesk/hbbs:/root
    environment:
      - "RELAY=igcc.cc:6017"   # 运行这些容器的服务器的【IP:port】或域名
      - "ENCRYPTED_ONLY=1"      # 开启加密
      # - "KEY=xxxxxx"            # 自定义KEY，去掉这一行可以自动生成
    networks:
      - vinet
    depends_on:
      - hbbr
    restart: unless-stopped

  hbbr: # RustDesk 中继服务器
    container_name: rustdesk-hbbr
    hostname: hbbr
    ports:
      - 6017:21117           # TCP中继
      - 6019:21119           # 如果要运行web客户端，则使用TCP进行web套接字
    #image: rustdesk/rustdesk-server:latest
    image: rustdesk/rustdesk-server:1.1.14
    command: hbbr
    volumes:
      - $HOME/run/docker_map/rustdesk/hbbr:/root
    networks:
      - vinet
    restart: unless-stopped
