如何将 WebStorm 调试器附加到 docker 容器上已运行的节点进程

How to attach WebStorm debugger to an already running node process on a docker container

提问人:Swapnil Biswas 提问时间:10/9/2023 最后编辑:LazyOneSwapnil Biswas 更新时间:10/11/2023 访问量:41

问:

有三种服务。我想通过 webstorm 调试 api 服务。

docker-compose 文件

version: '3'
services:
  nginx:
    restart: always
    build:
      context: ./nginx
      dockerfile: Dockerfile.dev
    ports:
      - '5000:80'
      - "9229:9229"

  api:
    build:
      context: ./api
      dockerfile: Dockerfile.dev
    volumes:
      - /app/node_modules
      - ./api:/app

  web:
    build:
      context: ./web
      dockerfile: Dockerfile.dev
    volumes:
      - /app/node_modules
      - ./web:/app

使用 nodemon 运行节点服务器。

nodemon -L --inspect=0.0.0.0:9229 index.js

如图所示,调试器连接到 9229 端口:

enter image description here

用于附加调试器的 WebStorm 配置:

enter image description here

尽管如此,断点仍未命中。谁能帮忙?

节点.js docker docker-compose 网络风暴

评论


答: 暂无答案