whoami icon indicating copy to clipboard operation
whoami copied to clipboard

GRPC is not working

Open arulrajnet opened this issue 5 months ago • 3 comments

Welcome!

  • [x] Yes, I've searched similar issues on GitHub and didn't find any.

What did you do?

I tried the steps in the README

arul@mac ~$ls -l grpc.proto
-rw-r--r--@ 1 arul  staff   455B  3 Jul 14:57 grpc.proto

arul@mac ~$docker run -d -p 8080:80 --name iamfoo traefik/whoami
1e3512c0a9034364ec189d66b115c1f36867110a298167d0d3493991a61ae56b

arul@mac ~$grpcurl -plaintext -proto grpc.proto localhost:8080 whoami.Whoami/Whoami
Failed to dial target host "localhost:8080": context deadline exceeded

What were you expecting?

My expectation is, it should return the following response

{
  "hostname": "5a45e21984b4",
  "iface": [
    "127.0.0.1",
    "::1",
    "172.17.0.2"
  ]
}

What version are you using?

v1.11 linux/arm64

The SHA of docker is sha256:200689790a0a0ea48ca45992e0450bc26ccab5307375b41c84dfc4f2475937ab

What is your environment & configuration?

docker run -d -p 8080:80 --name iamfoo traefik/whoami

If applicable, please paste the log output in DEBUG level

Here are the logs

arul@mac ~$docker logs iamfoo
2025/07/03 09:33:10 Starting up on port 80

arulrajnet avatar Jul 03 '25 09:07 arulrajnet

I think it's gotta be some networking issue.

I faced the same issue when I ran the binary inside a docker container as follows -

docker run --rm -d -p 8180:80 --name whoami traefik/whoami
...
769b96567929   traefik/whoami   "/whoami"                2 hours ago   Up 2 hours   0.0.0.0:8180->80/tcp   whoami
$ grpcurl -plaintext -proto grpc.proto localhost:8180 whoami.Whoami/Whoami 
Failed to dial target host "localhost:8180": context deadline exceeded

However, at the same time HTTP/1.x connection to the same docker container succeeds.

$ curl http://localhost:8180                                             
Hostname: 769b96567929
IP: 127.0.0.1
IP: ::1
IP: 172.17.0.2
RemoteAddr: 172.17.0.1:43368
GET / HTTP/1.1
Host: localhost:8180
User-Agent: curl/7.81.0
Accept: */*

But I don't think it's an issue with the binary itself, as if I build, and run the binary myself on a local port (minus the container abstractions), it works as expected over grpc -

$ ./whoami -port 8081 &
...
$ grpcurl -plaintext -proto grpc.proto localhost:8081 whoami.Whoami/Whoami
{
  "hostname": "lldevgt-xxx-yyy",
  "iface": [
    "127.0.0.1",
    "192.168.4.97",
    "172.17.0.1",
    "172.23.114.1",
    "172.19.0.1",
    "fc00:f853:ccd:e793::1",
    "fe80::42:6bff:fe7a:a21a",
    "fe80::1",
    "172.18.0.1",
    "10.2.4.47"
  ]
}

makeittotop avatar Jul 24 '25 19:07 makeittotop

Ah. I get it. The traefik/whoami:latest image is in fact v.1.11.0 pushed to dockerhub about 4 months ago, which doesn't have any grpc code implemented. Hence it fails. Code

makeittotop avatar Jul 24 '25 20:07 makeittotop

Thank you, @makeittotop.

My follow-up question is: When will the latest Docker image be published with this changes.?

arulrajnet avatar Jul 24 '25 23:07 arulrajnet