yarn install error Couldn't find a package.json during Docker build yarn install error Couldn't find a package.json during Docker build docker docker

yarn install error Couldn't find a package.json during Docker build


When you build a docker image, no files are copied automatically in the docker image despite that are part of the docker build context . (depends also of your .dockerignore file configuration if you have any). To add files from the docker context to your docker image you can do it explicitly with running commands like ADD or COPY.

Below an example of dockerfile:

WORKDIR /appCOPY ["yarn.lock", "package.json", "./"]# Install app dependenciesRUN yarn install --check-files --non-interactive --ignore-optional --frozen-lockfile