Container on Unraid to communicate with my RaspberryPi


Recommended Posts

Hello,
This might be better suited for the docker containers category but I thought it'd fit here nicely too.

I have a raspberry pi previous to me setting up unraid on my server. I wanted to continue using it as its already running InfluxDB. I want to add a Grafana dashboard to Unraid using Telegraf.

Grafana and InfluxDB both are running on the raspberry pi. I need to understand how to get my docker containers on my unraid server to communicate with them. Is there another way instead of creating a swarm? if not, how can I open the corresponding ports in order to make my server the docker swarm manager.

I'm trying to get my telegraf docker container on Unraid to communicate with the InfluxDB docker container located on the rPi. Both systems are currently using the network for the container as "host".

I have already installed ufw on my raspberry pi to manage the ports needed for setting up docker swarm. I want to cut down on the total number of containers being ran on my server while using my rPi for the majority of containers that don't need to be manually started. (example: a minecraft server i would run wouldn't need to run on the rPi because its not up 24/7, only when I want it to be. Hence the difference in hosts.)

In short; how caveman get docker talk to different hosts when one unraid other pie????

Any and all help is highly appreciated

Link to comment
2 minutes ago, Ford Prefect said:

...use a macvlan network on the Pi and on unRAID (like br0) and your docker containers can communicate like any other host via IP, including routing via your router if you chose to use different IP networks


My friend told me to try this out today as well, ill give it a go. I was about to mess around with the iptables but im going to attempt this first. Thanks

Link to comment
1 hour ago, Ford Prefect said:

...here is a good read: https://sreeninet.wordpress.com/2016/05/29/macvlan-and-ipvlan/

When you set things up, I also suggest to use some kind of tool to manage things, like portainer (which is a docker image/container, too)

I can get the containers to ping each other on the different hosts but cannot get the Telegraf container on Unraid to use the port off the InfluxDB IP address after setting up the macvlan and didn't see anything about this in the guide.


Raspberry Pi - InfluxDB

        "NetworkSettings": {
            "Bridge": "",
            "SandboxID": "d6fc10978d69493a381b40d53fa6049198cbc439c162acf6d986fd2ebe476be5",
            "HairpinMode": false,
            "LinkLocalIPv6Address": "",
            "LinkLocalIPv6PrefixLen": 0,
            "Ports": {},
            "SandboxKey": "/var/run/docker/netns/d6fc10978d69",
            "SecondaryIPAddresses": null,
            "SecondaryIPv6Addresses": null,
            "EndpointID": "",
            "Gateway": "",
            "GlobalIPv6Address": "",
            "GlobalIPv6PrefixLen": 0,
            "IPAddress": "",
            "IPPrefixLen": 0,
            "IPv6Gateway": "",
            "MacAddress": "",
            "Networks": {
                "br0": {
                    "IPAMConfig": null,
                    "Links": null,
                    "Aliases": [
                        "b09baf1f8a30"
                    ],
                    "NetworkID": "9c5236ed9ad9fbecc5156564ff89114ed8990a8bf3975572e5c1eed1d35ca9f2",
                    "EndpointID": "13e6437b36cfdf51978881946b7866b02efcbb98ae29ba81e1bc5c033d319273",
                    "Gateway": "192.168.1.1",
                    "IPAddress": "192.168.1.2",
                    "IPPrefixLen": 24,
                    "IPv6Gateway": "",
                    "GlobalIPv6Address": "",
                    "GlobalIPv6PrefixLen": 0,
                    "MacAddress": "02:42:c0:a8:01:02",
                    "DriverOpts": null
                }
            }
        }
    }
]


Unraid - Telegraf

            "Networks": {
                "br0": {
                    "IPAMConfig": {
                        "IPv4Address": "192.168.1.172"
                    },
                    "Links": null,
                    "Aliases": [
                        "6ca01559a554"
                    ],
                    "NetworkID": "c78bbfad94bca0355629fb7d6fad8bbc8f09df66485c6dd08856236c0a6c45e0",
                    "EndpointID": "2ed2f0bb4567664aefbe8d7a6b5622a52ef927be735ffe4e627ad31519fded89",
                    "Gateway": "192.168.1.1",
                    "IPAddress": "192.168.1.172",
                    "IPPrefixLen": 24,
                    "IPv6Gateway": "",
                    "GlobalIPv6Address": "",
                    "GlobalIPv6PrefixLen": 0,
                    "MacAddress": "02:42:c0:a8:01:ac",
                    "DriverOpts": null
                }
            }
        }
    }
]





Raspberry - just to be on the same page, I purposely named the macvlan on the rPi to "br0" and it should not be confused with the Unraid macvlan

pi@raspberrypi:~/IOTstack $ docker network inspect br0
[
    {
        "Name": "br0",
        "Id": "9c5236ed9ad9fbecc5156564ff89114ed8990a8bf3975572e5c1eed1d35ca9f2",
        "Created": "2020-05-05T21:31:03.585611491+01:00",
        "Scope": "local",
        "Driver": "macvlan",
        "EnableIPv6": false,
        "IPAM": {
            "Driver": "default",
            "Options": {},
            "Config": [
                {
                    "Subnet": "192.168.1.0/24",
                    "Gateway": "192.168.1.1",
                    "AuxiliaryAddresses": {
                        "raspberrypi": "192.168.1.170"
                    }
                }
            ]
        },
        "Internal": false,
        "Attachable": false,
        "Ingress": false,
        "ConfigFrom": {
            "Network": ""
        },
        "ConfigOnly": false,
        "Containers": {
            "60874181bff53b1d3599b319b9b6bd3f72e536ce07ff400f7dd32294d81373c7": {
                "Name": "influxdb",
                "EndpointID": "84b580b85f4f8c4b6af33c8b7f69a57969be59ad2629ab6d26eb969a39b7cf01",
                "MacAddress": "02:42:c0:a8:01:02",
                "IPv4Address": "192.168.1.2/24",
                "IPv6Address": ""
            }
        },
        "Options": {
            "parent": "eth0"
        },
        "Labels": {}
    }
]





 

Link to comment

...ping is a good start but not proof.

The name of the interface is also not important, I think, as long as the driver is macvlan.

 

If you want to test, install a network tool in both containers, like iperf and test with client&server combos on different ports on both sides.

 

I am not literate enough in the XML based configs, hence my recommendation for portainer, which will also allow you to manage docker networks.

 

My experience is, whether the container app, like influxDB, will be able to use the ip interface completely, will depend on how the container image is mastered with regards of network startup.

If in (default) host mode, a port forward config is needed, try this under macvlan as well.

Also trying another docker image which is more flexible in that regard is an option.

 

 

Gesendet von meinem SM-G960F mit Tapatalk

 

 

 

 

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.