简体   繁体   English

WebStorm 2018.1:我无法从docker容器中查找运行远程调试打字稿的断点

[英]WebStorm 2018.1: I am not able to hit breakpoints running remote debugging typescript from docker container

I am using the docker integration tool to run docker-compose to start two containers, one for node and one for mongodb. 我使用docker集成工具运行docker-compose来启动两个容器,一个用于节点,一个用于mongodb。

Here is the docker-compose.yml file: 这是docker-compose.yml文件:

version: '2.1'
services:
 mongo:
    container_name: "app_mongo"
    hostname: "mongo"
    tty: true
    image: mongo:latest
    environment:
      - MONGO_DATA_DIR=/data/db
      - MONGO_LOG_DIR=/dev/null
      - MONGO_INITDB_DATABASE=***********
      - MONGO_INITDB_ROOT_USERNAME=************
      - MONGO_INITDB_ROOT_PASSWORD=********************
    volumes:
      - /data/db:/data/db
    ports:
      - 27017:27017
    command: "mongod --smallfiles --auth"
    networks:
      - my-app-network
 group:
     container_name: "app_api1"
     hostname: "api1"
     build:
       context: .
       dockerfile: api1.dev.yml
     entrypoint: ["npm", "run", "debug"]
     volumes:
       - ".:/home/app"
     ports:
       - 3000:3000
       - 56745:56745
     depends_on:
       - "mongo"
     networks:
       - my-app-network
networks:
    my-app-network:
       driver: bridge

Here is the api1.dev.yml file: 这是api1.dev.yml文件:

FROM node:latest

ADD package.json /tmp/package.json
RUN cd /tmp && npm install --production && npm install -g nodemon
RUN mkdir -p /home/app && cp -a /tmp/node_modules /home/app/ && mkdir -p /home/app/dist

ADD package.json /home/app/package.json
ADD .env /home/app/.env
WORKDIR /home/app

Here is the script entry in package.json: 这是package.json中的脚本条目:

"scripts": {
  "debug": "nodemon --inspect=56745 --require ts-node/register app/app.ts"
  // "debug": "nodemon -L --inspect=56745 dist/myapp/app.js"
}

I also added a new "Attach to Node.js/Chrome" item to attach to the debugging port for node. 我还添加了一个新的“附加到Node.js / Chrome”项目以附加到节点的调试端口。

I run the docker-compose file followed by debugging the "Attach to Node.js/Chrome" item after node is up and listening. 我运行docker-compose文件,然后在节点启动和监听后调试“Attach to Node.js / Chrome”项。

When I try to hit a breakpoint in a .ts file, nothing is happening. 当我尝试在.ts文件中点击断点时,什么也没发生。 I am seeing the endpoint is called. 我看到端点被调用。

What are the steps involved in debugging a typescript app from docker and what am I doing wrong? 从docker调试打字稿应用程序涉及的步骤是什么?我做错了什么?

Where can I find a good tutorial that walks through how to debug typecript for a node.js app hosted inside of a docker container? 我在哪里可以找到一个很好的教程,介绍如何为docker容器中托管的node.js应用程序调试类型操作?

An answer was finally provided to me. 最后给了我答案。 Ultimately, I had to change the debug script from "debug": "nodemon -L --inspect=56745 dist/myapp/app.js" to "nodemon -L --inspect=0.0.0.0:56745 dist/myapp/app.js". 最终,我不得不将调试脚本从“debug”更改为:“nodemon -L --inspect = 56745 dist / myapp / app.js”改为“nodemon -L --inspect = 0.0.0.0:56745 dist / myapp / app” .js文件”。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Docker容器中的远程调试运行过程 - Remote debugging running process inside docker container 即使在非常简单的设置中,也无法在 WebStorm 中找到任何断点 - Not able to hit any Breakpoints in WebStorm, even in very simple setting WebStorm调试不会在断点上停止 - WebStorm debugging not stopping on breakpoints 在Docker容器中运行和调试测试 - Running and debugging tests in a Docker container 调试Node app时在Mac OS上的WebStorm 2018.1中看不到框架 - Not seeing frames in WebStorm 2018.1 on Mac OS while debugging Node app 能够连接到本地运行在Docker容器中的MongoDB,但不能从另一个容器连接 - Able to connect to MongoDB running in a Docker container locally, but not from another container 在 docker 容器中调试 React 应用程序时,VSCode 断点未绑定 - VSCode breakpoints unbound when debugging a React app in a docker container 当我点击 https://<external ip> , 我希望能够访问在 GEC 中容器的 3000 端口上运行的应用程序</external> - When I hit https://<external IP>, I want to be able to access the application running on port 3000 on the container in GEC 我在从 Docker 容器到本地运行的 API 的此 API 调用上映射端口是否错误? - Am I mapping ports wrong on this API call from a Docker container to a locally running API? VS Code 未为在 Docker 容器中运行的 Node 应用程序设置断点 - VS Code not hitting breakpoints for Node app running in Docker Container
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM