Docker container running but unable to connect to localhost:8000 via browser?

I’ve a docker container running on port 8000 but can’t connect to localhost:8000 via browser.

The port mapping is there and my server is able to start and connect to postgres db. Is there an issue with port forwarding?

I’m using WSL on Windows to run my containers.

Dockerfile

FROM node:16.15-alpine3.14

WORKDIR /usr/src/app

COPY . .

RUN npm install

EXPOSE 8000

CMD [ "npm", "run", "start-dev" ]

docker-compose.yml

version: "2"
services:
  postgres:
    image: postgres
    environment:
      - POSTGRES_USER=postgres
      - POSTGRES_PASSWORD=iclasspg
    ports:
      - '5432:5432'

  iclassbe:
    build:
      context: .
    environment:
      - DB_PASSWORD=iclasspg
      - DB_SCHEMA=postgres
      - DB_USER=postgres
      - DB_HOST=postgres
      - DB_PORT=5432
      - DB_SSL=false
    depends_on:
      - postgres
    ports:
      - '8000:8000'

Make sure your node application actually binds 0.0.0.0:8000 and not just 127.0.0.1:8000.