-
Notifications
You must be signed in to change notification settings - Fork 28.3k
Hot reload doesn't work inside Docker container #71622
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Isn't this I'm pretty sure that if you want "outside" changes to be reflected inside the container in real time (without rebuilding), you need to mount the directory as a volume instead of just copying it. |
Exactly. Volume mapping is in the docker-compose.yml file. As I said earlier:
|
Same problem here in nextjs 15 doesnt work wit turbopack in nextjs 14.2.5 its work nvm after I mirrored this one it works somehow: volumes:
|
Downgraded to [email protected]: With:
After saving changes in page.tsx on the PC, the .next/server/app/page.js both on PC and container is updated same as page.tsx in container. However changes in app running inside container remains not updated in browser. After page reload i have:
The same error occurs with:
|
Having same issue with "next": "^15.0.0". |
Placing
Inside the
Keep in mind that you still need to add
|
It's still not working for me |
This worked for me: Edit the file "package.json" like so: "scripts": { |
This worked for me:
import type { NextConfig } from "next";
const nextConfig: NextConfig = {
output: "standalone",
};
export default nextConfig;
...
frontend:
build:
context: ./frontend
dockerfile: Dockerfile
target: dev
container_name: frontend-dev
volumes:
- ./frontend:/app
- /app/node_modules
restart: unless-stopped
ports:
- "3000:3000"
env_file:
- .env
depends_on:
- backend
networks:
- devnet
command: npm run dev
...
"scripts": {
"dev": "WATCHPACK_POLLING=true next dev",
"build": "next build",
"start": "next start",
"lint": "next lint"
},
"dependencies": {
"lucide-react": "^0.479.0",
"next": "^15.2.4",
"next-themes": "^0.4.6",
"react": "^19.1.0",
"react-dom": "^19.1.0",
"react-hook-form": "^7.55.0",
}, |
This comment has been minimized.
This comment has been minimized.
Another approach to accomplish this is by utilizing Docker compose watch feature. Here is example:
|
Link to the code that reproduces this issue
https://github.com/ArtoszBart/next-issue
To Reproduce
docker-compose up
Current vs. Expected behavior
Hot reload should reload the page to show changes, but changes is not visible in the browser
Provide environment information
Physical PC: Operating System: Platform: win32 Arch: x64 Version: Windows 10 Education Available memory (MB): 16319 Available CPU cores: 16 Binaries: Node: 20.18.0 npm: N/A Yarn: N/A pnpm: N/A Relevant Packages: next: 15.0.0 // Latest available version is detected (15.0.0). eslint-config-next: 15.0.0 react: 19.0.0-rc-65a56d0e-20241020 react-dom: 19.0.0-rc-65a56d0e-20241020 typescript: 5.6.3 Next.js Config: output: N/A Container: Operating System: Platform: linux Arch: x64 Version: #1 SMP Fri Mar 29 23:14:13 UTC 2024 Available memory (MB): 7911 Available CPU cores: 16 Binaries: Node: 20.18.0 npm: 10.8.2 Yarn: 1.22.22 pnpm: N/A Relevant Packages: next: 15.0.0 // Latest available version is detected (15.0.0). eslint-config-next: 15.0.0 react: 19.0.0-rc-65a56d0e-20241020 react-dom: 19.0.0-rc-65a56d0e-20241020 typescript: 5.6.3 Next.js Config: output: N/A
Which area(s) are affected? (Select all that apply)
Developer Experience
Which stage(s) are affected? (Select all that apply)
next dev (local)
Additional context
After saving changes in page.tsx on the PC, the .next/server/chunks/ssr on PC is updated same as page.tsx in container. However .next/server/chunks/ssr in container remains not updated.
The text was updated successfully, but these errors were encountered: