Ir al contenido principal


Mostrando entradas de septiembre, 2017

Creating a Docker container for a NodeJs application: Express + Mongo + Docker Compose

This is a Docker tutorial for creating a NodeJs container using expressjs and mongoose, above is the vid and below you will find the steps followed. Steps Pre-reqs Have node.js installed And docker installed (make sure you have docker-compose as well) Create an simple node app using expressjs and mongoose Modify your container and create a docker-compose file Build and Run your new container Create your simple node app Initialize the node app npm init Install the dependencies for our app npm install --save express mongoose  Create the database.js Create the index.js Create a dockerfile Include container with node preinstalled:  FROM node Create default/working directory:  WORKDIR /usr/src/app Copy package.json to workdir and install dependencies (which we will need in this case😊):   COPY package.json . RUN npm install Copy the rest of the app (just the index.js file in this case) COPY . . Expose the port required for reaching