title: How to use child_process inside nodejs application running inside docker container
body: <p>I try to run one nodejs application inside of docker container. Everything is as expect once I get into docker container and execute the application. However, once I use docker exec to send the command to container. The error is occured as <i>TypeError: Object # has no method 'execSync'</i>. How can I use child_prcess in my node application from docker container?</p>
  
  <pre><code>root@17dbb03697b0:/apps# cat test.js
  var aaa = require('child_process').execSync('echo "aaaaaaaaa"').toString().trim();
  console.log(aaa);
  root@17dbb03697b0:/apps# node test.js
  aaaaaaaaa
  root@17dbb03697b0:/apps#
  
  user@ip-172-1-1-121:~/$ docker exec containername bash -c "cd /apps;node test.js"
  
  /apps/test.js:1
  module, __filename, __dirname) { var aaa = require('child_process').execSync('
                                                                      ^
  TypeError: Object #&lt;Object&gt; has no method 'execSync'
      at Object.&lt;anonymous&gt; (/apps/test.js:1:98)
      at Module._compile (module.js:456:26)
      at Object.Module._extensions..js (module.js:474:10)
      at Module.load (module.js:356:32)
      at Function.Module._load (module.js:312:12)
      at Function.Module.runMain (module.js:497:10)
      at startup (node.js:119:16)
      at node.js:902:3
  user@ip-172-1-1-121:~/$ docker exec containername bash -c "cd /apps/;cat test.js"
  var aaa = require('child_process').execSync('echo "aaaaaaaaa"').toString().trim();
  console.log(aaa);
  </code></pre>