title: Docker compose missing yarn dependencies on build
body: <p>Can't get node_modules folder when running yarn install in the Dockerfile</p>
  
  <pre><code>test-sof
  ├── docker-compose.yml
  ├── Dockerfile
  ├── package.json
  └── yarn.lock
  </code></pre>
  
  <p>docker-compose.yml</p>
  
  <pre><code>version: '3'
  services:
    web:
      build: .
      volumes:
        - .:/myapp
  </code></pre>
  
  <p>package.json</p>
  
  <pre><code>{
    "name": "site",
    "private": true,
    "dependencies": {
      "@rails/webpacker": "^3.2.1",
      "babel-preset-react": "^6.24.1",
      "prop-types": "^15.6.0",
      "react": "^16.2.0",
      "react-dom": "^16.2.0",
      "reactjs": "^1.0.0",
      "underscore": "^1.8.3"
    },
    "devDependencies": {
      "webpack-dev-server": "^2.11.1"
    }
  }
  </code></pre>
  
  <p>Dockferfile</p>
  
  <pre><code>FROM ruby:2.5
  
  RUN curl -sL https://deb.nodesource.com/setup_8.x | bash - &amp;&amp; \
      curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - &amp;&amp; \
      echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list &amp;&amp; \
      apt-get update &amp;&amp; \
      apt-get install -qq -y build-essential libpq-dev nodejs yarn
  
  RUN mkdir /myapp
  WORKDIR /myapp
  
  ADD ./package.json /myapp/
  
  RUN yarn install
  </code></pre>
  
  <p>output of the step RUN yarn install when <strong>docker-compose build</strong>:</p>
  
  <blockquote>
  <pre><code>Step 6/6 : RUN yarn install
  ---&gt; Running in 3a0e7095ec81 
  yarn install v1.3.2 
  info No lockfile found. 
  [1/4] Resolving packages... 
  [2/4] Fetching packages... 
  info fsevents@1.1.3: The platform "linux" is incompatible with this module. 
  info "fsevents@1.1.3" is an optional dependency and failed compatibility check. Excluding it from installation. 
  [3/4] Linking dependencies... 
  warning "@rails/webpacker &gt; postcss-cssnext@3.1.0" has unmet peer dependency "caniuse-lite@^1.0.30000697". 
  warning " &gt; webpack-dev-server@2.11.1" has unmet peer dependency "webpack@^2.2.0 || ^3.0.0". 
  warning "webpack-dev-server &gt; webpack-dev-middleware@1.12.2" has unmet peer dependency "webpack@^1.0.0 || ^2.0.0 || ^3.0.0". 
  [4/4] Building fresh packages... 
  success Saved lockfile. 
  Done in 21.11s. 
  Removing intermediate container 3a0e7095ec81  
  ---&gt; 5720579a0f2a 
  Successfully built 5720579a0f2a 
  Successfully tagged testsof_web:latest
  </code></pre>
  </blockquote>
  
  <p>Running command: <strong>docker-compose run web bash</strong> to get in the container</p>
  
  <pre><code>root@11af1818e494:/myapp# ls    
  Dockerfile  docker-compose.yml  package.json
  </code></pre>
  
  <p>no node_modules folder present, but later when running inside the container: <strong>yarn install</strong> output:</p>
  
  <blockquote>
  <pre><code>root@11af1818e494:/myapp# yarn install
  yarn install v1.3.2
  info No lockfile found. 
  [1/4] Resolving packages... 
  [2/4] Fetching packages... 
  info fsevents@1.1.3: The platform "linux" is incompatible with this module. 
  info "fsevents@1.1.3" is an optional dependency and failed compatibility check. Excluding it from installation. 
  [3/4] Linking dependencies... 
  warning "@rails/webpacker &gt; postcss-cssnext@3.1.0" has unmet peer dependency "caniuse-lite@^1.0.30000697". 
  warning " &gt; webpack-dev-server@2.11.1" has unmet peer dependency "webpack@^2.2.0 || ^3.0.0". 
  warning "webpack-dev-server &gt; webpack-dev-middleware@1.12.2" has unmet peer dependency "webpack@^1.0.0 || ^2.0.0 || ^3.0.0". 
  [4/4] Building fresh packages... 
  success Saved lockfile. 
  Done in 13.03s.
  </code></pre>
  </blockquote>
  
  <p>then when listing: </p>
  
  <pre><code>root@11af1818e494:/myapp# ls    
  Dockerfile  docker-compose.yml  node_modules  package.json  yarn.lock
  </code></pre>
  
  <p>folder node_modules IT IS present. Why?</p>