Hello fellow forum members,
I am having trouble running an Express application using Docker compose. I am using the following Dockerfile:
FROM node:6 # Install app dependencies RUN mkdir -p /usr/src/app WORKDIR /usr/src/app COPY package.json /usr/src/app/ RUN npm install # Bundle app source COPY . /usr/src/app EXPOSE 3000
Here is my docker-compose.yml file:
version: '2' services: db: image: mongo ports: - "27017:27017" command: "--smallfiles --logpath=/dev/null" web: build: . command: npm start volumes: - .:/usr/src/app/ ports: - "49160:3000" depends_on: - db
I am trying to run the application by
docker-compose build then
However, I am finding out that if I do not have the
node_modules folder on the host, the app does not run at all.
I am assuming that running
npm install in the
Dockerfile should install the dependencies in the container, but apparently that is not happening. Is there something I am missing?
I would really appreciate anything that would help point me in the right direction.
Docker version 1.11.1, build 5604cbe
docker-compose version 1.7.1, build 0a9ab35
Ubuntu 14.04 x64 3.13.0-85-generic