[with-docker] COPY failed: stat app/.next/standalone: file does not exist
See original GitHub issueVerify canary release
- I verified that the issue exists in the latest Next.js canary release
Provide environment information
Operating System:
Platform: linux
Arch: x64
Version: #18~20.04.1-Ubuntu SMP Sun Jul 3 08:20:07 UTC 2022
Binaries:
Node: 16.16.0
npm: 8.11.0
Yarn: N/A
pnpm: N/A
Relevant packages:
next: 12.0.10
react: 17.0.2
react-dom: 17.0.2
Which example does this report relate to?
with-docker
What browser are you using? (if relevant)
No response
How are you deploying your application? (if relevant)
No response
Describe the Bug
I am running sudo docker build -t myapp .
(on a GCP VM) and I get this error below:
Step 21/26 : COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
COPY failed: stat app/.next/standalone: file does not exist
Note: I’ve done all required step for existing projects
as described here.
Expected Behavior
Build the image without error
To Reproduce
- Copy Dockerfile in the base directory of your app
- Update next.config.js like so:
// next.config.js
module.exports = {
// ... rest of the configuration.
output: 'standalone',
}
- Run
sudo docker build -t myapp .
Issue Analytics
- State:
- Created a year ago
- Comments:5 (1 by maintainers)
Top Results From Across the Web
Can't create a docker image for COPY failed: stat /var/lib ...
I had another case wherein I was using a directory from the parent directory and docker can only access files present below the...
Read more >COPY failed: stat /var/lib/docker/tmp/docker ... - GitHub
Description I have a Dockerfile that has the line: COPY MyAgSourceAPI/conf/php/testsql.php /var/www/ But it causes the error: COPY failed: ...
Read more >Docker COPY failed: stat no source files were specified - Jhooq
6 Ways to fix – Docker COPY failed: stat no source files were specified · Source path is incorrect · Incorrect file ·...
Read more >stat /var/lib/docker/tmp/docker-xxx : no such file or directory
The target/demo-0.0.1-SNAPSHOT.jar file I am trying to copy is present in my github repository. Not sure what could be happening with the ...
Read more >COPY failed stat var lib docker tmp docker-builder root page ...
To copy files from the base system to the docker container, you have to make sure that all the files are present where...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This is because you are on an older version of Next.js (
12.0.10
) that did not useoutput: "standalone"
butexperimental: {outputStandalone: true}
. You should upgradenext@latest
and it should work. (Note thatexperimental
features are not covered by semver. Relevant PR #37994)This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.