title: "EACCESS: permission denied" with Webpack run in a Docker container with a USER set in the dockerfile
body: <p>I've been using docker containers for a couple years but I've just recently decided that I need to improve the security and user management of the container by declaring a USER within the Dockerfile. </p>
  
  <p>My setup works on Windows 10, but I get a permission error on Mac. </p>
  
  <p>By the way, I'm using docker-compose to build and run everything and I've installed Docker Toolbox. </p>
  
  <p>So, this is what I've added to the docker file: </p>
  
  <pre><code># add node user
  RUN groupadd --system --gid 61000 buink-group
  RUN useradd --no-log-init --system --uid 61000 --gid buink-group node-user
  RUN chgrp --recursive buink-group /var/www/html
  RUN chmod g+rwx /var/www/html
  
  ...
  
  # set user as node-user
  USER node-user
  </code></pre>
  
  <p>I use a file called start.sh as the entry point and within that file I run:</p>
  
  <pre><code>npm run watch-poll
  </code></pre>
  
  <p>Here is the error that I get:</p>
  
  <pre><code>node-container | 
   95% emittingError: EACCES: permission denied, mkdir '/var/www/html/public/js'
  node-container | npm ERR! code ELIFECYCLE
  node-container | npm ERR! errno 1
  node-container | npm ERR! @ watch: `cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --progress --hide-modules --config=webpack.config.js "--watch-poll=200"`
  node-container | npm ERR! Exit status 1
  node-container | npm ERR! 
  node-container | npm ERR! Failed at the @ watch script.
  node-container | npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
  node-container | 
  node-container | npm ERR! A complete log of this run can be found in:
  node-container | npm ERR!     /home/node-user/.npm/_logs/2018-09-13T18_58_07_373Z-debug.log
  node-container | npm ERR! code ELIFECYCLE
  node-container | npm ERR! errno 1
  node-container | npm ERR! @ watch-poll: `npm run watch -- --watch-poll=200`
  node-container | npm ERR! Exit status 1
  node-container | npm ERR! 
  node-container | npm ERR! Failed at the @ watch-poll script.
  node-container | npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
  node-container | 
  node-container | npm ERR! A complete log of this run can be found in:
  node-container | npm ERR!     /home/node-user/.npm/_logs/2018-09-13T18_58_07_395Z-debug.log
  node-container exited with code 1
  </code></pre>
  
  <p>Here are the volumes in my docker-compose.yml file</p>
  
  <pre><code>volumes:
    - ./:/var/www/html
    - composer:/var/www/html/vendor
    - node_modules:/var/www/html/node_modules
  </code></pre>