title: Docker/Rails - Permission denied @ dir_s_mkdir Errno::EACCESS
body: <blockquote>
    <p>With Docker, I'd like to set up an environment where I can make
    changes on local files, while the container serves said files.</p>
  </blockquote>
  
  <p>However, I've been getting the following error, after running <code>docker-compose run web</code>:</p>
  
  <pre><code>=&gt; Booting WEBrick
  =&gt; Rails 5.0.0.1 application starting in development on http://0.0.0.0:3000
  =&gt; Run `rails server -h` for more startup options
  Exiting
  /usr/local/lib/ruby/2.3.0/fileutils.rb:253:in `mkdir': Permission denied @ dir_s_mkdir - /usr/src/app/tmp (Errno::EACCES)
          from /usr/local/lib/ruby/2.3.0/fileutils.rb:253:in `fu_mkdir'
          from /usr/local/lib/ruby/2.3.0/fileutils.rb:227:in `block (2 levels) in mkdir_p'
          from /usr/local/lib/ruby/2.3.0/fileutils.rb:225:in `reverse_each'
          from /usr/local/lib/ruby/2.3.0/fileutils.rb:225:in `block in mkdir_p'
          from /usr/local/lib/ruby/2.3.0/fileutils.rb:211:in `each'
          from /usr/local/lib/ruby/2.3.0/fileutils.rb:211:in `mkdir_p'
          from /usr/local/bundle/gems/railties-5.0.0.1/lib/rails/commands/server.rb:119:in `block in create_tmp_directories'
          from /usr/local/bundle/gems/railties-5.0.0.1/lib/rails/commands/server.rb:118:in `each'
          from /usr/local/bundle/gems/railties-5.0.0.1/lib/rails/commands/server.rb:118:in `create_tmp_directories'
          from /usr/local/bundle/gems/railties-5.0.0.1/lib/rails/commands/server.rb:75:in `start'
          from /usr/local/bundle/gems/railties-5.0.0.1/lib/rails/commands/commands_tasks.rb:90:in `block in server'
          from /usr/local/bundle/gems/railties-5.0.0.1/lib/rails/commands/commands_tasks.rb:85:in `tap'
          from /usr/local/bundle/gems/railties-5.0.0.1/lib/rails/commands/commands_tasks.rb:85:in `server'
          from /usr/local/bundle/gems/railties-5.0.0.1/lib/rails/commands/commands_tasks.rb:49:in `run_command!'
          from /usr/local/bundle/gems/railties-5.0.0.1/lib/rails/commands.rb:18:in `&lt;top (required)&gt;'
          from bin/rails:4:in `require'
          from bin/rails:4:in `&lt;main&gt;'
  </code></pre>
  
  <p>The drives are shared on Docker Settings, my Windows Account is Administrator, the PowerShell I'm running these commands at is running as Administrator, and the container's user is root, so I really can't find which permission is it lacking.</p>
  
  <p>I'm using <strong>Docker for Windows</strong> with <strong>Hyper-v</strong> driver, and the following <em>Dockerfile</em> and <em>docker-compose.yml</em> are within the application's directory:</p>
  
  <p><strong>Dockerfile</strong></p>
  
  <pre><code># Official Ubuntu image with Ruby installed
  FROM ruby:2.3.0
  
  # Update package lists and install dependencies
  RUN apt-get update &amp;&amp; apt-get install -y \
      build-essential \
      libpq-dev \
      postgresql-client \
      nodejs \
      sqlite3 \
      libqt4-webkit \
      libqt4-dev \
      xvfb \
    &amp;&amp; rm -rf /var/lib/apt/lists/*
  
  # Define where the application will live inside the image
  ENV APP_HOME /usr/src/app
  
  # Create the application folder
  RUN mkdir -p $APP_HOME
  
  # Set the working directory inside the image
  WORKDIR $APP_HOME
  
  # Add Gemfile and install dependencies
  COPY Gemfile* $APP_HOME/
  RUN bundle install
  
  # Copy local folder to work directory
  COPY . $APP_HOME
  </code></pre>
  
  <p><strong>docker-compose.yml</strong></p>
  
  <pre><code>version: '2'
  services:
    web:
      privileged: true
      build: .
      command: bundle exec rails server -p 3000 -b '0.0.0.0'
      volumes:
        - .:/usr/src/app
      ports:
        - "3000:3000"
  </code></pre>