简体   繁体   English

Node docker 不适用于 feathersjs - 容器正在运行但本地主机不可访问

[英]Node docker not working for feathersjs - Container running but localhost not accessable

I have a docker-compose file with mongo and an node container, mongo works great, but the node feathers container is not accessable from localhost:3030 (have also tried 127.0.0.1:3030 and 0.0.0.0:3030我有一个带有 mongo 和节点容器的 docker-compose 文件,mongo 工作得很好,但是无法从 localhost:3030 访问节点羽毛容器(也尝试过 127.0.0.1:3030 和 0.0.0.0:3030

version: "3"
services:
  app:
    image: node:lts-alpine
    volumes:
      - ./feathers-full:/app
    working_dir: /app
    depends_on:
      - mongo
    environment:
      NODE_ENV: development
    command: npm run dev
    ports:
      - 3030:3030
    expose:
      - "3030"
  mongo:
    image: mongo
    ports:
      - 27017:27017
    expose:
      - "27017"
    volumes:
      - ./data/db:/data/db

Are you binding to 127.0.0.1 in the Feathers server?您是否绑定到 Feathers 服务器中的 127.0.0.1? If so, you won't be able to access the server from outside the container.如果是这样,您将无法从容器外部访问服务器。 You need to bind to 0.0.0.0.您需要绑定到 0.0.0.0。 See https://pythonspeed.com/articles/docker-connection-refused/ for explanation why.请参阅https://pythonspeed.com/articles/docker-connection-refused/以了解原因。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM