"getsockopt: connection refused error" while talking to local grpc server

Ok, that means that the Tyk process, because it is running in the container, will be targeting the loopback interface of the container, and so querying port 50051 on the docker container, not your local OS.

You’ll need to set an explicit IP, this SO question is relevant to your scenario: