title: Docker /bin/bash: nodemon: command not found
body: <p>I am trying to mount my working node code from my host into a docker container and run it using nodemon using docker-compose.
  But container doesn't seems to be able to find nodemon.
  Note: My host machine does not has node or npm installed on it.</p>
  
  <p>Here are the files in the root folder of my project (test). (This is only a rough draft)</p>
  
  <p><strong>Dockerfile</strong></p>
  
  <pre><code>FROM surenderthakran/nodejs:v4
  ADD . /test
  WORKDIR /test
  RUN make install
  CMD make run
  </code></pre>
  
  <p><strong>Makefile</strong></p>
  
  <pre><code>SHELL:=/bin/bash
  PWD:=$(shell pwd)
  export PATH:= $(PWD)/node_modules/.bin:$(PWD)/bin:$(PATH)
  DOCKER:=$(shell grep docker /proc/1/cgroup)
  
  install:
      @echo Running make install......
      @npm config set unsafe-perm true
      @npm install
  
  run:
      @echo Running make run......
  # Check if we are inside docker container
  ifdef DOCKER
      @echo We are dockerized!! :D
      @nodemon index.js
  else
      @nodemon index.js
  endif
  
  .PHONY: install run
  </code></pre>
  
  <p><strong>docker-compose.yml</strong></p>
  
  <pre><code>app:
      build: .
      command: make run
      volumes:
          - .:/test
      environment:
          NODE_ENV: dev
      ports:
          - "17883:17883"
          - "17884:17884"
  </code></pre>
  
  <p><strong>package.json</strong></p>
  
  <pre><code>{
    "name": "test",
    "version": "1.0.0",
    "description": "test",
    "main": "index.js",
    "dependencies": {
      "express": "^4.13.3",
      "nodemon": "^1.8.0"
    },
    "devDependencies": {},
    "scripts": {
      "test": "echo \"Error: no test specified\" &amp;&amp; exit 1"
    },
    "keywords": [
      "api",
      "nodejs",
      "express"
    ],
    "author": "test",
    "license": "ISC"
  }
  </code></pre>
  
  <p><strong>index.js</strong></p>
  
  <pre><code>'use strict';
  
  var express = require('express');
  </code></pre>
  
  <p>I build my image using <code>docker-compose build</code>. It finishes successfully.
  But when I try to run it using <code>docker-compose up</code>, I get:</p>
  
  <pre><code>Creating test_app_1...
  Attaching to test_app_1
  app_1 | Running make run......
  app_1 | We are dockerized!! :D
  app_1 | /bin/bash: nodemon: command not found
  app_1 | make: *** [run] Error 127
  test_app_1 exited with code 2
  Gracefully stopping... (press Ctrl+C again to force)
  </code></pre>
  
  <p>Can anyone please advice?</p>
  
  <p><strong>Note:</strong> The Dockerfile for my base image <code>surenderthakran/nodejs:v4</code> can be found here: <a href="https://github.com/surenderthakran/dockerfile_nodejs/blob/master/Dockerfile" rel="noreferrer">https://github.com/surenderthakran/dockerfile_nodejs/blob/master/Dockerfile</a></p>