Untitled

 avatar
unknown
plain_text
5 months ago
797 B
3
Indexable
services: # services which our app going to use. (list of containers we want to create)
  mongoCont: # container name 
    image: mongo # which image container will build on
    ports:
      - "27017:27017"
    networks: # adding network
      - mern-app
    volumes:
      - mongo-data:/data/db

  api-server:
    build: . # build the Docker image for the service using the Dockerfile located in the current directory
    ports:
      - "3000:3000"
    networks: # adding network
      - mern-app
    depends_on:
      - mongoCont

networks: # allow services to talk to each other while providing isolation from other docker container, running on the same host
  mern-app:
    driver: bridge

volumes: # enable persistence of database data across container restart
  mongo-data:
    driver: local
Editor is loading...
Leave a Comment