🐛 BUG: Running dev server in Windows on a `node` Docker container fails
What version of astro are you using?
1.0.0-beta.59
Are you using an SSR adapter? If so, which one?
None
What package manager are you using?
npm
What operating system are you using?
Windows, Linux
Describe the Bug
Ref: https://discord.com/channels/830184174198718474/991708338301718558
During a support session, @aFuzzyBear and I were working on an HMR issue from @tusamni, we discovered that when running Astro from within a container on Windows, it isn't possible to connect from a browser on the host using the localhost address. I reproduced this behavior with both the Docker Community node image and Red Hat's node UBI image; furthermore, I was able to successfully connect to localhost using the Docker Community nginx image.
Curiously enough, this only happens on Windows and does not happen on Linux.
In all the following examples, localhost works in Linux, but it does not work on Windows.
(First, clone the site to any folder of your choice, then switch into that directory in a terminal prompt.)
$ podman run -it --rm --network host --user root --volume $(pwd):/mnt/site --workdir /mnt/site node:latest /bin/bash
$ docker run -it --rm --network host --user root --volume $(pwd):/mnt/site --workdir /mnt/site node:latest /bin/bash
$ podman run -it --rm --network host --user root --volume $(pwd):/mnt/site --workdir /mnt/site registry.access.redhat.com/ubi8/nodejs-16:latest /bin/bash
$ docker run -it --rm --network host --user root --volume $(pwd):/mnt/site --workdir /mnt/site registry.access.redhat.com/ubi8/nodejs-16:latest /bin/bash
Link to Minimal Reproducible Example
https://github.com/tusamni/astro-blog-portfolio
Participation
- [x] I am willing to submit a pull request for this issue.