简体   繁体   中英

Go micro dashboard does not register my service when running inside docker-compose

I'm new to go-micro, tried to have micro server running as another service in my docker-compose setup however my first micro-service is not getting show in Micro Web (the Go Micro dashboard). If I run micro server outside docker-compose I can see several go-micro-related micro-services in the dashboard, but inside docker-compose none is displayed.

I have put together an example code that reproduces what I experience, I generated the service using micro new and changed nothing in it, the docker-compose.yml reflects how I have it setup in my project where I began experiencing this:

https://github.com/shackra/go-micro-docker-compose-bug

What am I doing wrong and how do I get the Micro dashboard to work as expected inside docker-compose?

EDIT

I have added a network in docker compose without any luck, also made my example service compilable inside docker.

EDIT 2

if I restart the service micro complains about it:

micro_1    | 2020-07-02 03:25:36  file=auth/wrapper.go:84 level=error service=web none available
micro_1    | 172.21.0.1 - - [02/Jul/2020:03:25:36 +0000] "GET /services HTTP/1.1" 500 15 "http://localhost:8082/" "Mozilla/5.0 (X11; Linux x86_64; rv:77.0) Gecko/20100101 Firefox/77.0"
micro_1    | 2020-07-02 03:25:39  file=auth/wrapper.go:84 level=error service=web none available
micro_1    | 172.21.0.1 - - [02/Jul/2020:03:25:39 +0000] "GET /client HTTP/1.1" 500 15 "http://localhost:8082/" "Mozilla/5.0 (X11; Linux x86_64; rv:77.0) Gecko/20100101 Firefox/77.0"
micro_1    | 2020-07-02 03:28:34  file=auth/wrapper.go:84 level=error service=web none available
micro_1    | 172.21.0.1 - - [02/Jul/2020:03:28:34 +0000] "GET /client HTTP/1.1" 500 15 "http://localhost:8082/" "Mozilla/5.0 (X11; Linux x86_64; rv:77.0) Gecko/20100101 Firefox/77.0"
micro_1    | 2020-07-02 03:28:38  file=auth/wrapper.go:84 level=error service=web none available
micro_1    | 172.21.0.1 - - [02/Jul/2020:03:28:37 +0000] "GET /services HTTP/1.1" 500 15 "http://localhost:8082/" "Mozilla/5.0 (X11; Linux x86_64; rv:77.0) Gecko/20100101 Firefox/77.0"
example_1  | 2020-07-02 03:30:55  file=grpc/grpc.go:791 level=info Deregistering node: go.micro.service.example-58b408cc-eec2-41a3-8d7f-5ac1751ad795
example_1  | 2020-07-02 03:30:55  file=grpc/grpc.go:814 level=info Unsubscribing from topic: go.micro.service.example
example_1  | 2020-07-02 03:30:55  file=grpc/grpc.go:959 level=info Broker [http] Disconnected from 127.0.0.1:45863
micro_1    | 2020-07-02 03:30:55  file=registry/registry.go:102 level=error service=api unable to get go.micro.service.example service: service not found
go-micro-docker-compose-bug_example_1 exited with code 0
micro_1    | 2020-07-02 03:30:58  file=handler/handler.go:227 level=error service=debug Error calling go.micro.service.example@172.21.0.2:38625 ({"id":"go.micro.client","code":500,"detail":"connection error: desc = \"transport: Error while dialing dial tcp 172.21.0.2:38625: connect: connection refused\"","status":"Internal Server Error"})
micro_1    | 2020-07-02 03:31:08  file=handler/handler.go:227 level=error service=debug Error calling go.micro.service.example@172.21.0.2:38625 ({"id":"go.micro.client","code":500,"detail":"connection error: desc = \"transport: Error while dialing dial tcp 172.21.0.2:38625: connect: connection refused\"","status":"Internal Server Error"})
micro_1    | 2020-07-02 03:31:18  file=handler/handler.go:227 level=error service=debug Error calling go.micro.service.example@172.21.0.2:38625 ({"id":"go.micro.client","code":500,"detail":"connection error: desc = \"transport: Error while dialing dial tcp 172.21.0.2:38625: connect: connection refused\"","status":"Internal Server Error"})

I don't really get it, why would it report no services nor clients were found but still being able to connect with my service?

it seems that despite micro's dashboard showing nothing, if I issue micro list services my example service is listed

I then removed the network from the docker-compose.yml, stopped docker-compose and put it up again, issued micro list services again and my example service was included in the listing. So, this seems to be a bug with the dashboard itself.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM