Next.js Discord

Discord Forum

Can't get hot reload working in container

Unanswered
Lithuanian Hound posted this in #help-forum
Open in Discord
Lithuanian HoundOP
I just set up a new NextJS install, set up to run in docker, as per [this guide](https://medium.com/@itsuki.enjoy/dockerize-a-next-js-app-4b03021e084d). I brought my image up, using npm run dev, which according to package.json is next dev, which looks to be the command run according to docker logs. The page loads, but when I change something in the default page.tsx, it doesn't auto-reload. If I refresh myself, I see the changes, so I know the container is working. The files are mapped over as a volume, but I don't think that should matter.

I do see two errors in the console (though nothing in the docker logs):
WebSocket connection to 'ws://localhost/\_next/webpack-hmr' failed:

Error: A listener indicated an asynchronous response by returning true, but the message channel closed before a response was received


Looking online, I tried adding the CHOKIDAR_USEPOLLING=true and WATCHPACK_POLLING=true envvars, but no luck. I'd love feedback if it's my build, or if it's something else.

0 Replies