I'm trying to containerize a program that uses the Vimba SDK to control a GigE camera, which is connected by Ethernet from a secondary network interface on the host system.
Vimba seems to want direct control over the camera network interface. For example, it brings the interface up and configures its MTU. It works to run the container with --network host
to give it access to the eth0
interface on the host.
However I was wondering if it would be possible to use Docker networking to:
Allow the hosts on the LAN to access a web service running in the container (i.e.,
--publish 8080:8080/tcp
).Give the Vimba SDK a network interface it can control.
My attempt was to create a bridge network called net-1-lan
and a macvlan network called net-2-cam
. (Aside: The names are because when a container is in multiple networks, the network whose name comes first lexicographically gets chosen as the default route.)
docker network create net-1-lan # bridge network
docker network create \
--driver macvlan \
--opt parent=eth0 \
--subnet=169.254.1.0/24 \
net-2-cam
After I start my container in the bridge network, I use docker network connect
to add the container to the macvlan network. However, the Vimba SDK does not detect the camera.
One thing I note, but am unsure is relevant, is that the container gets IP address 169.254.1.2 on the macvlan interface. When running in --network host
mode, the interface claims 169.254.1.1.