[GH-ISSUE #2] Dokemon Node IP Address Issue #3

Closed
opened 2026-03-03 19:10:46 +03:00 by kerem · 5 comments
Owner

Originally created by @dnburgess on GitHub (Dec 12, 2023).
Original GitHub issue: https://github.com/productiveops/dokemon/issues/2

I noticed that any of the nodes that I'm able to add after your last update are linking to the main host IP address when going to the container page.

Basically I have 2 servers:

  • Dokemon at 192.168.0.27
  • Dockge at 192.168.0.7

When I go to the containers on the Dockge server, I see all the containers and ports and all that as expected, but the ports for the containers on the Dockge node at 192.168.0.7 link to the localhost IP of 192.168.0.27.

So Whoogle is deployed on 192.168.0.7:5000, but if I click it in the list of containers on my Dockge server, it takes me to 192.168.0.27:5000 instead.

Here's a video that shows it that might also help:
https://www.youtube.com/watch?v=cLRhcoTzeBQ

Originally created by @dnburgess on GitHub (Dec 12, 2023). Original GitHub issue: https://github.com/productiveops/dokemon/issues/2 I noticed that any of the nodes that I'm able to add after your last update are linking to the main host IP address when going to the container page. Basically I have 2 servers: - Dokemon at 192.168.0.27 - Dockge at 192.168.0.7 When I go to the containers on the Dockge server, I see all the containers and ports and all that as expected, but the ports for the containers on the Dockge node at 192.168.0.7 link to the localhost IP of 192.168.0.27. So Whoogle is deployed on 192.168.0.7:5000, but if I click it in the list of containers on my Dockge server, it takes me to 192.168.0.27:5000 instead. Here's a video that shows it that might also help: https://www.youtube.com/watch?v=cLRhcoTzeBQ
kerem closed this issue 2026-03-03 19:10:46 +03:00
Author
Owner

@salilponde commented on GitHub (Dec 13, 2023):

Thank you for reporting this, and great explanation video! I will take a look at this today.

<!-- gh-comment-id:1853272263 --> @salilponde commented on GitHub (Dec 13, 2023): Thank you for reporting this, and great explanation video! I will take a look at this today.
Author
Owner

@salilponde commented on GitHub (Dec 13, 2023):

This is challenging for the reasons mentioned here: https://stackoverflow.com/a/56486428/22850013. It it not wise for containers to know the IP address of the host and the Dokemon Agent runs as a container. There are a few answers in the same link but I tried them and their either return docker0 interface IP which is not the VM IP or they just don't work. So there will be compatibility issues even if I try to use one of the methods.

I checked Portainer CE and I see it opens http://0.0.0.0:PORTNUMBER which is not correct. I checked Yacht and Dockge and they currently do not support managing multiple servers so they do not have this challenge yet. What they (and Dokemon) do currently is use the protocol and host from the current URL in the browser and append the port of the container to it. So they will face the same challenges if they implement support for multiple servers in future.

If you know of any other tool which does this correctly then let me know.

So as a workaround what one can do now is to bind the containers to the IP address instead of binding to all IP addresses. For example.

# This binds to all IP addresses so Docker API returns IP as 0.0.0.0
-p 8080:8080

# Instead of above do this as a workaround to bind to specific IP. In this case Dokemon will correctly open 192.168.0.5:8080.
-p 192.168.0.5:8080:8080

However, I know people would not want to restart their working containers as mentioned above. So I will add a button to set the Base URL for the Node where you can set the URL to http://192.168.0.5 (or whatever URL you want). And the generated links will use this as the base URL.

This will work for simple scenarios. But won't work for all cases. For example, I run multiple web apps on my server on different ports and I have a reverse proxy (Traefik) which maps different DNS to different web apps. So I have subdomain1.example.com pointing to 1st app and subdomain2.example.com pointing to second app. So if I se the Base URL to subdomain1.example.com it will use this base url for both the containers which is not correct for the 2nd one. I thought of storing the base URL per container but that will get complex if people remove and create the container, its ID will change. So at the moment I will keep the Base URL at the Node level and not container level.

<!-- gh-comment-id:1853429052 --> @salilponde commented on GitHub (Dec 13, 2023): This is challenging for the reasons mentioned here: https://stackoverflow.com/a/56486428/22850013. It it not wise for containers to know the IP address of the host and the Dokemon Agent runs as a container. There are a few answers in the same link but I tried them and their either return docker0 interface IP which is not the VM IP or they just don't work. So there will be compatibility issues even if I try to use one of the methods. I checked Portainer CE and I see it opens http://0.0.0.0:PORTNUMBER which is not correct. I checked Yacht and Dockge and they currently do not support managing multiple servers so they do not have this challenge yet. What they (and Dokemon) do currently is use the protocol and host from the current URL in the browser and append the port of the container to it. So they will face the same challenges if they implement support for multiple servers in future. If you know of any other tool which does this correctly then let me know. So as a workaround what one can do now is to bind the containers to the IP address instead of binding to all IP addresses. For example. ``` # This binds to all IP addresses so Docker API returns IP as 0.0.0.0 -p 8080:8080 # Instead of above do this as a workaround to bind to specific IP. In this case Dokemon will correctly open 192.168.0.5:8080. -p 192.168.0.5:8080:8080 ``` However, I know people would not want to restart their working containers as mentioned above. So I will add a button to set the Base URL for the Node where you can set the URL to http://192.168.0.5 (or whatever URL you want). And the generated links will use this as the base URL. This will work for simple scenarios. But won't work for all cases. For example, I run multiple web apps on my server on different ports and I have a reverse proxy (Traefik) which maps different DNS to different web apps. So I have subdomain1.example.com pointing to 1st app and subdomain2.example.com pointing to second app. So if I se the Base URL to subdomain1.example.com it will use this base url for both the containers which is not correct for the 2nd one. I thought of storing the base URL per container but that will get complex if people remove and create the container, its ID will change. So at the moment I will keep the Base URL at the Node level and not container level.
Author
Owner

@salilponde commented on GitHub (Dec 13, 2023):

Released 1.1.2 which has the above feature.

<!-- gh-comment-id:1853744392 --> @salilponde commented on GitHub (Dec 13, 2023): Released 1.1.2 which has the above feature.
Author
Owner

@dnburgess commented on GitHub (Dec 13, 2023):

Looks good. Can verify that adding the node's IP addres in the port line as you described fixes this issue on the front end.

<!-- gh-comment-id:1854079057 --> @dnburgess commented on GitHub (Dec 13, 2023): Looks good. Can verify that adding the node's IP addres in the port line as you described fixes this issue on the front end.
Author
Owner

@salilponde commented on GitHub (Dec 13, 2023):

Thank you, closing.

<!-- gh-comment-id:1854475579 --> @salilponde commented on GitHub (Dec 13, 2023): Thank you, closing.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/dokemon#3
No description provided.