Want to access a service running outside docker container from an application inside the container using someIP

Hi Docker group,

Stuck in a weird situation.

We have two applications - one running inside a container and another outside the container directly on the Ubuntu Host.

Both the apps are using someIP for communication.

Agenda is , the application inside the container should be able to discover the service outside the container and able to communicate with it via someIP.

Issue : Containerized application is not able discover & communicate with service running outside.

someIP configuration of the app running inside container : 
{
    "unicast": "172.17.0.2",
    "applications": [
        {
            "name" : "Consumer",
            "id": "0x1002"
        }
    ],
    "clients" :
    [
        {
            "service" : "0x1234",
            "instance" : "0x5678",
            "unreliable" : [ 30509, 32344 ]
        }
    ],
    "routing" : "Consumer",
    "service-discovery" :
    {
    	"enable" : "true",
    	"multicast" : "224.244.224.245",
    	"port" : "30490",
    	"protocol" : "udp",
    	"initial_delay_min" : "10",
	"initial_delay_max" : "100",
	"repetitions_base_delay" : "200",
	"repetitions_max" : "3",
	"ttl" : "3",
	"cyclic_offer_delay" : "2000",
	"request_response_delay" : "1500"
    }
}
configuration of the application running outside container : 
{
    "unicast": "192.168.226.193",
    "applications": [
        {
            "name" : "Producer",
            "id": "0x1001"
        }
    ],
    "services": [
        {
            "service": "0x1234",
            "instance": "0x5678",
            "unreliable" : "30509",
            "events":[
            	{
                    "event" : "0x4321"
               }
            ],
            "eventgroups":[
            	{
                    "eventgroup" : "0x8765",
                    "events" : [ "0x4321"],
                    "multicast" :
                    {
                        "address" : "224.225.226.233",
                        "port" : "32344"
                    }
                }
            ],
            "multicast" :
            {
                "address" : "224.225.226.234",
                "port" : "32344"
            }
        }
    ],
    "routing" : "Producer",
    "service-discovery" :
     {
        "enable" : "true",
        "multicast" : "224.244.224.245",
        "port" : "30490",
        "protocol" : "udp"
     }
}

Docker Run command of the container :

docker run --rm -it --cap-add=NET_ADMIN --name cons-cont cons-someip-img

P.S : The container is up and running and waiting for someIP service to up.

Approaches Tried :

  1. Tried to ping host IP (192.168.226.193) from the container, and it worked.
  2. Tried to send UDP multicast packet from the host to the container and it worked :
    Container : tcpdump -i eth0 port 30490
    Host : echo -n “Hello SOME/IP” | nc -u -w1 172.17.0.2 30490

Worked, the message “Hello SOME/IP” is reaching the container from the host.
3. Tried with --network host, Macvlan and normal Bridge networks, still didn’t work.

Seems there is no issue with the network route, but still unable to find the root cause why service discovery cannot happen.

Any help would be helpful.

Hi all, any help would be appreciated.

A container attached to a bridge network will not share the same broadcast domain the host belongs to.

In order for a container to be part of the same broadcast domain as the host, it will either need to use host networking, or be attached to a macvlan or ipvlan v2 network.

Tried with Macvlan and ipvlan networks, nothing worked, confused about what configurations needs to be done so that service discovery multicast packets reaches the container from the host, have gone hrough the internet, other groups, didn’t get any fruitful information. Any concrete help would be appreciated.

“I tried ” does not really help to understand how you configured things. Please share the exact commands you used when creating the macvlan and ipvlan networks, and the exact configuration used for creating the container.