Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

So far, macvlan appears to be the only viable option.

It works more often than not but sometimes subscribers are unable to establish connection to a publisher. Restarting the subscriber container a couple of times seems to get things moving again. If you need to connect to the nodes in the containers from the host, you can add a bridge like so:

docker network create -d macvlan \
    --subnet=192.168.1.0/24 \
    --gateway=192.168.1.1 \
    --ip-range=192.168.1.192/26 \
    --aux-address 'host=192.168.1.192'  \
    -o parent=eth0 macnet

sudo ip link add macnet-shim link eth0 type macvlan  mode bridge
sudo ip addr add 192.168.1.192/26 dev macnet-shim
sudo ip link set macnet-shim up

docker run --rm -d --network macnet <IMAGE>

So far, macvlan appears There appear to be the only viable option.two potential workarounds:

It works HOST:

If you want to use host networking, you also much share the pid space so that each DDS node can generate a unique GUID. ( All thanks go to @ruffsl, more detail here )

docker run --rm -d --net=host --pid=host <IMAGE>

MACVLAN:

This workaround seems to work more often than not but sometimes subscribers are unable the container needs to establish connection to a publisher. Restarting be restarted before it will see all nodes on the subscriber container a couple of times seems to get things moving again. If you need to connect to the nodes in the containers from the host, you can add a bridge like so:network.

docker network create -d macvlan \
    --subnet=192.168.1.0/24 \
    --gateway=192.168.1.1 \
    --ip-range=192.168.1.192/26 --ip-range=192.168.1.64/27 \
    --aux-address 'host=192.168.1.192'  --attachable \
    -o parent=eth0 parent=enp8s0 \
    macnet

sudo ip link add macnet-shim link eth0 type macvlan  mode bridge
sudo ip addr add 192.168.1.192/26 192.168.1.64/27 dev macnet-shim
sudo ip link set macnet-shim up

docker run --rm -d --network macnet --net=macnet <IMAGE>