C-Otto / lnd-manageJ

MIT License
52 stars 11 forks source link

Bug: Docker Container Starts but :8081 is unreachable #91

Closed zapomatic closed 9 months ago

zapomatic commented 9 months ago

Describe the bug

App builds and starts via docker, but is unreachable on http://localhost:8081

2024-02-13 20:38:59,871 INFO  org.springframework.boot.web.embedded.tomcat.TomcatWebServer: Tomcat started on port 8081 (http) with context path ''
2024-02-13 20:38:59,914 INFO  de.cotto.lndmanagej.Application: Started Application in 12.927 seconds (process running for 15.842)

It is connected to LND per the LND logs:

[WRN] RPCP: A new gRPC middleware with the name 'lnd-manageJ' was registered  with custom_macaroon_caveat='', read_only=true. Make sure you trust the middleware author since that code will be able to intercept and possibly modify any gRPC messages sent/received to/from a client that has a macaroon with that custom caveat.

After 10 minutes, I start seeing metrics logs so it's clearly running but something is off with the port mapping:

2024-02-13 20:48:50,896 INFO  Metrics: type=TIMER, name=de.cotto.lndmanagej.controller.ChannelController.getBalance, count=0, min=0.0, max=0.0, mean=0.0, stddev=0.0, p50=0.0, p75=0.0, p95=0.0, p98=0.0, p99=0.0, p999=0.0, m1_rate=0.0, m5_rate=0.0, m15_rate=0.0, mean_rate=0.0, rate_unit=events/second, duration_unit=milliseconds
... etc

stopping the docker container exits from LND:

2024-02-13 21:00:00.223 [ERR] RPCP: Received an error: rpc error: code = Canceled desc = context canceled, shutting down
2024-02-13 21:00:00.224 [ERR] RPCS: [/lnrpc.Lightning/RegisterRPCMiddleware]: rpc error: code = Canceled desc = context canceled

To Reproduce

docker build --no-cache -t lnd-managej .
docker run --rm --network host --name lndmj -v ~/.config:/root/.config -v ~/.lnd:/root/.lnd lnd-managej

Expected behavior App reachable on :8081

C-Otto commented 9 months ago

You're on Mac, right?

The host networking driver only works on Linux hosts, and is not supported on Docker Desktop for Mac, Docker Desktop for Windows, or Docker EE for Windows Server.

https://docs.docker.com/network/drivers/host/

zapomatic commented 9 months ago

That's it. Needs to just use default bridge, so omitting the --network flag :)

C-Otto commented 9 months ago

I don't quite remember why I added it. Please let me know if you notice any issues!