Node.js 无法从Windows主机连接到Docker容器

Node.js 无法从Windows主机连接到Docker容器,node.js,docker,docker-compose,Node.js,Docker,Docker Compose,因此,我在docker compose中运行了以下内容: version: "3.7" services: api: build: context: ../hikrr_API dockerfile: Dockerfile ports: - "4000:4000" # volumes: # - ../hikr

因此,我在docker compose中运行了以下内容:

version: "3.7"
services:
    api:
        build:
            context: ../hikrr_API
            dockerfile: Dockerfile
        ports:
            - "4000:4000"
        # volumes:
        #     - ../hikrr_API:/usr/src/
    gui:
        build:
            context: ../hikrr_GUI
            dockerfile: Dockerfile
        ports:
            - "3000:3000"
        volumes:
            - ../hikrr_GUI:/usr/src/
        stdin_open: true
        environment:
            - CHOKIDAR_USEPOLLING=true
api=一个非常简单的节点应用程序,纯粹用于测试

此应用程序的docker文件:

FROM node:13
# Create app directory
WORKDIR /usr/src/

# Install app dependencies
# A wildcard is used to ensure both package.json AND package-lock.json are copied
# where available (npm@5+)
COPY package.json ./

RUN npm install
# If you are building your code for production
# RUN npm ci --only=production

# Bundle app source
COPY . .

EXPOSE 4000

# CMD [ "npm", "run", "start:dev" ]
CMD [ "node", "app.js" ]
gui=一个react应用程序

当我执行
docker compose-up--build
时,我得到了预期的终端输出(没有错误)

然而,当我试图联系api服务时,通过一个cURL,我得到了
错误:套接字挂起

curl --location --request GET 'http://localhost:4000'
在没有docker的情况下运行节点应用程序(在项目根目录中运行
node app.js
)可以正常工作。我可以用上面的卷曲打这个

我该如何调试这个?有什么想法吗

操作系统:Windows 10