title: Docker compose cant find package.json in path
body: <p>I am trying to dockerize my node app but I can't seem to understand why it can't find the package.json file because the package.json file is in the same path as the docker compose and dockerfile. Here is the folder structure:</p>
  
  <p><a href="https://i.stack.imgur.com/RjG8f.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/RjG8f.png" alt="enter image description here"></a></p>
  
  <p>Below is the dockerfile:</p>
  
  <p><strong>Dockerfile</strong></p>
  
  <pre><code>FROM node:12
  
  # RUN mkdir -p ./usr/src/app/
  COPY . /usr/src/app/
  
  WORKDIR /usr/src/app/
  
  # ADD package.json /usr/src/app/package.json
  COPY package*.json ./
  
  RUN yarn
  RUN yarn global add pm2
  
  COPY . .
  
  EXPOSE 3005
  EXPOSE 9200
  
  CMD yarn start:dev
  </code></pre>
  
  <p>And the docker compose file:</p>
  
  <p><strong>docker-compose.yml</strong></p>
  
  <pre><code>version: "3.6"
  services:
    api:
      image: node:12.13.0-alpine
      container_name: cont
      build:
        context: .
        dockerfile: Dockerfile
      ports:
        - 3005:3005
      environment:
        - JWT_TOKEN_SECRET=ajsonwebtokensecret
        - MONGO_URI=mongodb://localhost:27017/em
        - PORT=3005
        - MAIL_USER=******
        - MAIL_PASS=******
        - FORGOT_PASS_EMAIL=noreply@em.com
        - CLIENT_SIDE_URL=http://localhost:3001
        - ELASTICSEARCH_URI=http://localhost:9200
     volumes:
        - .:/usr/src/app/
      command: yarn start:dev
      links:
        - elasticsearch
      depends_on:
        - elasticsearch
      networks:
        - esnet
    elasticsearch:
      container_name: em-elasticsearch
      image: docker.elastic.co/elasticsearch/elasticsearch:7.6.0
      volumes:
        - esdata:/usr/share/elasticsearch/data
      environment:
        - bootstrap.memory_lock=true
        - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
        - discovery.type=single-node
      logging:
        driver: none
      ports:
        - 9300:9300
        - 9200:9200
      networks:
        - esnet
  volumes:
    esdata:
  networks:
    esnet:
  </code></pre>
  
  <p>When i try to run <code>docker compose up</code> i get this error</p>
  
  <blockquote>
    <p>cont       | yarn run v1.19.1</p>
    
    <p>cont       | error Couldn't find a package.json file in "/"</p>
    
    <p>cont       | info Visit <a href="https://yarnpkg.com/en/docs/cli/run" rel="nofollow noreferrer">https://yarnpkg.com/en/docs/cli/run</a> for documentation about this 
    command.</p>
    
    <p>cont exited with code 1</p>
  </blockquote>
  
  <p>I have tried <a href="https://stackoverflow.com/questions/58081376/docker-compose-cant-find-local-package">this</a>, but all solutions I have tried don't work. Does anyone have a solution to this?</p>