/docker-node-express-mongo

Skeleton for Node, Express, and Mongo in Docker

Primary LanguageJavaScript

Docker-Node-Express-Mongo Skeleton

Overview

This is a super basic skeleton for running an Express API with Mongo in Docker. Code is mapped into the Node container with a volume and hot code reloading is enabled. MongoDB data is not persisted to the host.

Requirements:
  • Docker
  • Docker Compose
Build images
docker-compose build
Install NPM dependencies

Note: This step creates ./node_modules on the host.

docker-compose run --rm api npm install
Run it!
docker-compose up -d

Visit http://localhost:8080/api

Get the logs
docker-compose logs -f
Stop and remove all containers
docker-compose down
Install and save NPM packages
docker-compose run --rm api npm --save <PACKAGE_NAME>