SK
Signal K•2mo ago
Mastiff

Unable to connect to GPSD on another Pi in Bridge mode

I have GPSD on a Pi with the IP 192.168.3.2, while SignalK is running on 192.168.3.1 in a Docker containr. If I run in bridge mode, it can't connect to the other Pi's GPSD, but in host mote I see that it connects in the logs flying past in the bash window when I start the container without the -d switch. Only then it won't accept connections on port 80, for some reason. I know I don't have anything else running on port 80. I have these ports in bridge mode: ports: - 80:80 - 1884:1884 - 2947:2947 network_mode: bridge The 1884 is the internal MQTT broker in "Signal K MQTT Gateway". So theoretically that should have no problems connecting to 2947, which is the port of GPSD. It just won't. It's stuck on "connecting to 192.168.3.2:2947". Any idea what this can be?
34 Replies
Teppo Kurki
Teppo Kurki•2mo ago
the ports configuration is all about accessing services running in the container from outside the container, it has nothing to do with accessing services outside the container for example 80:80 means "make the service that is running inside the container on port 80 accessible on the host computer's port 80". if you are using the standard sk image there is nothing running on port 80 inside the container, the sk server is on port 3000 so if you want it on port 80 of the host it should be 80:3000
Mastiff
Mastiff•2mo ago
Thanks, but no. I am running that on 80. I have set it to 80 in HTTP port. So I should be able to access port 80 inside the container no matter what.
Teppo Kurki
Teppo Kurki•2mo ago
when sk server starts it outputs the port it is listening on in the log, you can verify there if you have configured it as you think anyway, that is kinda besides the point here
Mastiff
Mastiff•2mo ago
Yeah, you're right. That doesn't explain why it can't connect o the GPSD in bridge mode, but can in host mode.
Teppo Kurki
Teppo Kurki•2mo ago
there is something blocking access to 192.168.3.2:2947. are you on windows? is there a firewall? can you access it from the host?
Mastiff
Mastiff•2mo ago
First, to clear that up, from the log: SignalK | signalk-server running at 0.0.0.0:80 Second, no, a Pi, as the first message states. And every time I start in host mode, I can access GPSD on 192.168.3.2:2947, but not the server on port 80 from outside, and every time I start in Bridge mode that reverses. Maybe the installation is damaged, and I should try to set it up from the ground again. I moved the Docker stuff to an SSD a few days ago, since they were starting to take up a lot of space, using instructions from the Docker forum. Perhaps it has messed up some symbolic links or something. No, a new installation didn't change anything. But now I see that I get an error on host mode with 80 as the port, even though "sudo ss" does not show anything else using that port: Error: listen EACCES: permission denied 0.0.0.0:80 SignalK | at Server.setupListenHandle [as _listen2] (node:net:1881:21) SignalK | at listenInCluster (node:net:1946:12) SignalK | at Server.listen (node:net:2044:7) SignalK | at Server.<anonymous> (/usr/lib/node_modules/signalk-server/lib/index.js:333:24) SignalK | at Generator.next (<anonymous>) SignalK | at fulfilled (/usr/lib/node_modules/signalk-server/lib/index.js:23:58) SignalK | at process.processTicksAndRejections (node:internal/process/task_queues:95:5) { SignalK | code: 'EACCES', SignalK | errno: -13, SignalK | syscall: 'listen', SignalK | address: '0.0.0.0', SignalK | port: 80 SignalK | } But with 3000 as the GUI port and host mode, GUI works and GPSD works. Very strange, isn't it?
Teppo Kurki
Teppo Kurki•2mo ago
ah, sk docker image is using user node that is not privileged and can not bind to ports <1024. so that is not related to host/bridge network driver you can fire up a generic linux machine docker run -it --rm busybox and then do telnet 192.168.3.2 2947 to verify that you can connect to GPSD from a generic docker container with the default bridge network
Mastiff
Mastiff•2mo ago
Thanks for answering! I know I can connect from another container, because I am connecting from Node-RED in Docker to the very same GPSD. So the solution is to change the port of GPSD on the secondary Pi, then? There is not much running there, so I'm sure I can find a port that's not i use. Like 666... (Finnish metal rules! 🤘 )
Teppo Kurki
Teppo Kurki•2mo ago
the gpsd port should not make a difference
Mastiff
Mastiff•2mo ago
OK, I see. Is this something that I maybe should go to the Docker forum with, to find out why the SignalK can't connect to GPSD port 2947 on host mode?
Teppo Kurki
Teppo Kurki•2mo ago
you just said that host mode, GUI works and GPSD works?
Mastiff
Mastiff•2mo ago
Yeah, but only with the GUI on 3000, and I would like to have it on the regular HTTP port 80, I have a bunch of devices that use it. So if I can either get GPSD working on bridge mode or port 80 for the GUI working on host mode, either way is good.
Teppo Kurki
Teppo Kurki•2mo ago
i am not aware of a way to get port 80 with the standard sk server image in host mode. you'd need to build your own image with user as root but i have a hard time understanding why gpsd is not accessible in bridge mode
Mastiff
Mastiff•2mo ago
I was just going to ask if you thought it was possible to connet to GPSD on 2947 on bridge mode... Will my full Docker Compose file help any? services: signalk-server: image: cr.signalk.io/signalk/signalk-server:latest container_name: SignalK restart: no group_add: - "20" ports: - 80:80 - 1884:1884 network_mode: bridge devices: - /dev/ttyUSB0:/dev/ttyUSB0 #Sailor Hat - /dev/ttyUSB1:/dev/ttyUSB1 #Garmin volumes: - /dev:/dev - /media/pi/Docker/Docker-Compose/SignalK/SignalK-data:/home/node/.signalk entrypoint: sh /home/node/signalk/startup.sh privileged: true logging: options: max-size: 10m (I don't know how to make the file format look normal here on Discord, sorry...)
Teppo Kurki
Teppo Kurki•2mo ago
put triple backticks around it
code here
code here
Want results from more Discord servers?
Add your server