title: Docker compose run yarn install
body: <p>When running the step <strong>RUN yarn install</strong> in a Dockerfile during docker-compose build command, I get:</p>
  
  <blockquote>
    <p>[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 > postcss-cssnext@3.1.0" has
    unmet peer dependency "caniuse-lite@^1.0.30000697". warning " >
    webpack-dev-server@2.11.1" has unmet peer dependency "webpack@^2.2.0
    || ^3.0.0". warning "webpack-dev-server >
    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...</p>
  </blockquote>
  
  <p>but the node_modules folder is NOT created. On the other hand when I run </p>
  
  <pre><code>docker-compose run SERVICE_NAME yarn install
  </code></pre>
  
  <p>I get:</p>
  
  <blockquote>
    <p>[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 > postcss-cssnext@3.1.0" has
    unmet peer dependency "caniuse-lite@^1.0.30000697". warning " >
    webpack-dev-server@2.11.1" has unmet peer dependency "webpack@^2.2.0
    || ^3.0.0". warning "webpack-dev-server >
    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...</p>
  </blockquote>
  
  <p>but then the folder <strong>node_modules</strong> IT IS created in the project folder.</p>
  
  <p>I just don't understand why ... I'm expecting same functionality but I'm missing something.</p>
  
  <p>Here my docker-compose service</p>
  
  <pre><code>services:
    ruby:
      build:
        context: .
        dockerfile: docker/ruby/Dockerfile
      networks:
        - some-network
      volumes:
        - .:/app
      ports:
        - "3000:3000"
      depends_on:
        - mysql
      command: bundle exec rails s -p 3000 -b '0.0.0.0'
  </code></pre>
  
  <p>Dockerfile</p>
  
  <pre><code>FROM ruby:2.5
  
  # Install dependencies:
  # - build-essential: To ensure certain gems can be compiled
  # - nodejs: Compile assets
  # - npm: Install node modules
  # - yarn: Install &amp; manage node modules [should make npm obsolete]
  # - libpq-dev
  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 nodejs yarn \
      libpq-dev \
      mysql-client 
  
  RUN mkdir /app
  COPY . /app
  
  WORKDIR /app
  
  # install node dependencies
  RUN yarn install
  
  RUN bundle install
  </code></pre>