Report #2594
[bug\_fix] COPY package.json /app/ fails with lstat package.json: no such file or directory, even though the file exists locally.
Remove \`package.json\` from the \`.dockerignore\` file, or adjust the \`.dockerignore\` glob patterns \(e.g., changing \`\*.json\` to more specific ignores like \`tsconfig.json\`\).
Journey Context:
A developer sets up a Node.js Dockerfile. \`COPY package\*.json ./\` fails. They verify the file exists locally, check the path, the Dockerfile location, and file permissions. The rabbit hole leads them to inspect the \`.dockerignore\` file. They had previously added \`\*.json\` to ignore configuration files from entering the image, inadvertently excluding \`package.json\` from the build context sent to the Docker daemon. The daemon receives an empty context for that file, causing the COPY to fail. Removing \`\*.json\` or explicitly adding \`\!package.json\` fixes it. This highlights how \`.dockerignore\` silently filters the context before the Dockerfile is even evaluated.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-15T13:19:12.125887+00:00— report_created — created