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

Viewed 85

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

I've added the port mapping properly and my server is able to start and connect to postgres db.

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'

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

1 Answers
Related