You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

手动运行与VSCode运行Dev Container时的GRPC连接错误

容器间GRPC双向通信故障排查

我负责的工程分为两个子项目,每个子项目都包含GRPC客户端与服务端,需要在各自容器内实现互通。此前通过VS Code的Dev Container扩展可以正常运行整个工程,现在希望脱离VSCode复现该运行环境,同时要能进入两个容器的交互式终端。

我使用了一个Python脚本解析常见Dev Container配置选项,完成容器的构建与运行,目前能成功启动两个容器,但遇到了GRPC连接问题。

问题场景

  • 客户端C向端口55055上的服务端S发送ping消息,服务端S收到后通过同一通信通道回复pong,客户端C能成功接收。
  • 服务端S尝试向端口55056上的客户端C发送通知,操作失败。

GRPC报错信息如下:

rpc error: code = Unavailable desc = connection closed before server preface received

注:暂时无法提供最小复现示例,如需相关细节可补充。

补充docker-compose配置(修正了配置内的拼写错误):

services:
  prime:
    image: "my/prime:development"
    container_name: "my-prime"
    build:
      context: ${PRIME_PATH}
      dockerfile: .devcontainer/Dockerfile
    tty: true
    stdin_open: true
    command: bash
    ports:
      - 55055:55055
    volumes:
      - prime:/prime
      - type: bind
        source: ${PRIME_PATH}
        target: /prime
    working_dir: /prime    
  plugin:
    image: "my/tfplugin:development"
    container_name: "tfplugin"
    build:
      context: ${PLUGIN_PATH}
      dockerfile: .devcontainer/Dockerfile
    tty: true
    stdin_open: true
    ports:
      - 55056:55056
    volumes:
      - plugin:/home/tfprime/.cache/bazel
      - type: bind
        source: ${PLUGIN_PATH}
        target: /tfprime
    working_dir: /tfprime     

volumes:
  prime:
  plugin:

内容的提问来源于stack exchange,提问作者Nick Skywalker

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.03 15:35:25