shunping commented on code in PR #35964:
URL: https://github.com/apache/beam/pull/35964#discussion_r2304186267


##########
sdks/go/pkg/beam/runners/prism/internal/worker/worker.go:
##########
@@ -79,8 +82,32 @@ type controlResponder interface {
        Respond(*fnpb.InstructionResponse)
 }
 
+// resolveEndpoint checks if the worker is running inside a docker container 
on mac or Windows and
+// if the endpoint is a "localhost" endpoint. If so, overrides it with 
"host.docker.internal".
+// Reference: 
https://docs.docker.com/desktop/features/networking/#networking-mode-and-dns-behaviour-for-mac-and-windows
+func (wk *W) resolveEndpoint(endpoint string) string {
+       // The presence of an external environment does not guarantee execution 
within
+       // Docker, as Python's LOOPBACK also runs in an external environment.
+       // A specific check for the "BEAM_WORKER_POOL_IN_DOCKER_VM" environment 
variable is required to confirm
+       // if the worker is running inside a Docker container.

Review Comment:
   Right. Basically, if a worker is running inside a docker and we provide a 
localhost provisioning address, it is going to look at the docker's own port. 
In order to access the host port, we have to use a different host name.
   
   That's only for mac or windows though. Docker running on linux does not have 
this issue.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscr...@beam.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to