简体   繁体   中英

NodeJS Website Not Served to Local Machines from Docker Container

I have a simple NodeJS website. I serve it up locally to port 80 via:

npm start

and all is well. I can access the website through the local ip on phones and other devices using the same network, including the computer itself.

However, when I serve to 80 from the docker container running the npm server via

docker run -p 80:80

All seems well when I test the local ip on the host machine itself. But when I try to access it using phones and other devices using same network, I timeout.

I would expect the docker website to work everywhere on the local network, just the same as my non-container npm start command.

Windows Defender Firewall was blocking the connections going to and from the container.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM