skip to Main Content

I’m coding with NestJS and using Docker, I can’t configure my own docker-compose file to serve on the local network card with IP 192.168.1.7.

i saw this link before.

Docker subnet: 192.168.65.0

networks:
  host:
    name: mamanpaz
    external: true
  lan_access:
    driver: bridge

services:
  application:
    build:
      context: .
      dockerfile: apps/application/Dockerfile
      target: development
    command: npm run start:dev application
    env_file:
      - apps/application/.env
    depends_on:
      - rabbitmq
      - register
    volumes:
      - .:/usr/src/app
      - /usr/src/app/node_modules
    networks:
      - default
    extra_hosts:
      - "host.docker.internal:host-gateway"
    ports:
      - '3000:3000'

docker network ls command output

NETWORK ID     NAME                  DRIVER    SCOPE
2b6d6312d176   bridge                bridge    local
a776b0af5ba3   host                  host      local
b152fd5400db   mamanpaz_default      bridge    local
4b401d652fb2   my-network            bridge    local
6476cf7a691a   none                  null      local

2

Answers


  1. Chosen as BEST ANSWER

    Enabling Debian distribute via Settings->Resources -> WSL integration in Docker Desktop solved my problem


  2. Make sure you’re accessing the API on port 3000, not with the IP alone. Otherwise, you need to forward port 80:3000 (assuming NestJS is actually configured to run on port 3000)

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search