Connecting Docker Containers on Windows

TLDR: use host.docker.internal instead of localhost or 127.0.0.1 to connect a Docker container to another container on the local host.

I was recently struggling to get a containerized app running because it needed a connection to a postgres database which was also running in a container. Telling the app container to connect to localhost didn't work of course because postgres was not running inside of the app container. Some Googling eventually led me to this answer on StackOverflow. All I needed to do was replace localhost with host.docker.internal and it magically connected.