FROM node:latest
RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app
COPY package.json /usr/src/app
RUN npm install
COPY . /usr/src/app
EXPOSE 9000
RUN npm install -g nodemon
CMD ["node","server.js"]
version: "2" services: app: container_name: app restart: always build: . ports: - "9000:9000" links: - mongo mongo: container_name: mongo image: mongo #volumes: # - ./data:/data/db ports: - "27017:27017"
Have a look at the Article Published on Dockerizing Nodejs MongoDB