title: Docker app in Exited (0) status
body: <p>I'm trying to run a little server application in a Docker container</p>
  
  <p>index.js</p>
  
  <pre><code>var server_port = 3111
  , http     = require('http')
  , mosca    = require('mosca')
  , dispatch = require('dispatch')
  , httpServ = http.createServer(
      dispatch({
          '/': function(req, res, next){
              console.log('in route');
          }
      })
  );
  
  httpServ.listen(server_port, function() {
      console.log("listening on", server_port);
  });
  </code></pre>
  
  <p>package.json</p>
  
  <pre><code>{
    "dependencies": {
      "dispatch": "^1.0.0"
    },
    "description": "",
    "engines": {
      "node": "&gt;= 0.10.4"
    },
    "main": "index.js",
    "name": "SimpleServer",
    "version": "0.0.1"
  }
  </code></pre>
  
  <p>Dockerfile</p>
  
  <pre><code>FROM    centos:centos6
  
  # Enable EPEL for Node.js
  RUN     rpm -Uvh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
  # Install Node.js and npm
  RUN     yum install -y npm
  
  # Install nodemon
  RUN npm install -g nodemon
  
  # Bundle app source
  COPY . /src
  # Install app dependencies
  RUN cd /src; npm install
  
  # Expose port
  EXPOSE  3111
  
  # Run app using nodemon
  RUN echo "***" &amp;&amp; pwd &amp;&amp; echo "***"
  CMD ["nodemon", "/src/index.js"]
  </code></pre>
  
  <p>In the Docker Terminal, and within the SimpleServer working directory, the command <code>$ docker build -t test_simple  .</code> resulted in <code>Successfully built 43c8806574f4</code>. Any attempt so far to run the image in a container, such as <code>$ docker run -p 3111 test_simple</code> consistently results in the code exiting, and the server not running.</p>
  
  <pre><code>$ docker run -p 3111 test_simple
  19 Aug 07:22:56 - [nodemon] v1.4.1
  19 Aug 07:22:56 - [nodemon] to restart at any time, enter `rs`
  19 Aug 07:22:56 - [nodemon] watching: *.*
  19 Aug 07:22:56 - [nodemon] starting `node /src/index.js`
  Master: 16
  19 Aug 07:22:57 - [nodemon] clean exit - waiting for changes before restart
  
  $ docker run -d -P test_simple node /src/index.js
  a0a56ec5c13161bc37b523be0e32edec0a43ca82e7db88ddb2a91688f745b24b
  
  $ docker ps -l
  CONTAINER ID        IMAGE               COMMAND                CREATED             STATUS                     PORTS               NAMES
  a0a56ec5c131        test_simple         "node /src/index.js"   6 seconds ago       Exited (0) 6 seconds ago                       jolly_bohr
  </code></pre>
  
  <p>I cannot tell what's going on, and why the server is exiting. Any feedback is appreciated. Thanks.</p>