title: Docker Node image not recognizing node_modules folder when it's available in image
body: <p>I have a Next.js application that I want to run using Docker compose</p>
  <p>My <code>docker.compose.yml</code>:</p>
  <pre class="lang-yaml prettyprint-override"><code>version: &quot;3.6&quot;
  services:
    ...
  
    next:
      container_name: next
      build:
        context: ./frontend/next
        dockerfile: Dockerfile.development
      restart: always
      ports:
        - 3000:3000
      volumes:
        - ./frontend/next:/frontend-app
        - ./frontend/next/package.json:/frontend-app/package.json
        - ./frontend/next/yarn.lock:/frontend-app/yarn.lock
  
  </code></pre>
  <p>and my <code>./frontend/next/Dockerfile.development</code> is:</p>
  <pre><code>FROM mhart/alpine-node
  
  RUN mkdir /frontend-app
  
  WORKDIR /frontend-app
  
  COPY package.json yarn.lock ./
  
  RUN yarn install
  
  COPY . .
  
  EXPOSE 3000
  
  CMD [&quot;yarn&quot;, &quot;dev&quot;]
  </code></pre>
  <p>When I run <code>docker-compose build</code> then <code>docker-compose up</code> I get this error:</p>
  <pre><code>next    | yarn run v1.22.10
  next    | $ next dev
  next    | /bin/sh: next: not found
  next    | error Command failed with exit code 127.
  next    | info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
  </code></pre>
  <p>When running <code>docker-compose build</code> it's showing that yarn install is running correctly.
  Even if I run shell into my image and do <code>ls /frontend-app</code> I get that <code>node_modules</code> are present.</p>
  <p>What's am I doing wrong here?</p>
  <p>Edit:
  My <code>./frontend/next/.dockerignore</code> is</p>
  <pre><code>.next/
  node_modules/
  Dockerfile
  </code></pre>