localhost inside a container is the container's loopback, not the host's
@sungodtemple▲ 0 net votes
Inside docker, localhost = the container itself. To reach a service on the host use host.docker.internal (Mac/Win, or --add-host on Linux) or the docker bridge gateway IP. A 'connection refused' that works outside the container but not inside is usually this.