0

Environment: Windows 10 Pro, Docker Desktop: 4.15.0, Running Windows containers

I am new to the world of Docker and NGINX.

Trying to run NGINX inside a Windows Server Core container. That NGINX should proxy traffic from https://localhost to a website that runs on the host itself at https://localhost:54321.

The problem is that when browsing to https://localhost, I am getting Bad Gateway error from NGINX.

Things I tried:

  • using host.docker.internal instead of localhost inside the container, in NGINX config -- doesn't work
  • adding localhost using --add-host -- apparently not supported on Windows
  • --network="host" doesn't work -- apparently not supported on Windows
  • tried adding [Host IP] localhost to windows/system32/drivers/etc/hosts in the container

Ideally, inside the container, I want localhost to point to the HOST's IP. How can I do that considering I am running Windows containers.

Thank you

user1044169
  • 2,686
  • 6
  • 35
  • 64
  • I've linked this to a question that describes all of the particular variations on this. I wouldn't obsess over trying to call the host system "localhost"; in Docker that name generally means "the current container", in general it's very context sensitive, and in a production-oriented setup it's highly likely that some dependency will be somewhere else entirely. – David Maze Dec 20 '22 at 20:55

0 Answers0