Background
Hello all. I am attempting to solve a problem by placing complex systems within Docker containers. The platform hosting these containers has 6+ ethernet ports on NIC cards which are used in a variety of ways (cameras connected to two ports, a system LAN connected to another port, etc.).
On the system LAN, I need to assign each Docker container its own IP address on the LAN’s subnet. The IP addresses of the cameras are on a different subnet and persisted directly on the cameras themselves.
What I Have Done
In order to assign static IP addresses to the containers on the system LAN, I implemented that network with a MACVLAN driver and fussed with the routing table on the host. This works as expected, providing access to other platforms on the system LAN.
In order to be able to access the cameras from the containers, I implemented that network with an IPVLAN driver. This solution provides limited access to the cameras. More on this shortly. I started out attempting to use the MACVLAN driver for the cameras, but had no access to the camera’s IP addresses within the containers.
Pleora has a simple utility called DeviceFinder
that successfully finds the camera from within the container, but is not able to connect with it. When I run DeviceFinder
from the host, it successfully finds the camera and connects to it, provided my Docker containers are not running at that time. If the containers are running, the behavior of DeviceFinder
on the host is identical to that inside the container.
Just for grins, I made the network_mode
be host on the container and shutdown all my other network implementations. DeviceFinder
worked like a charm inside the container. Of course this will not work for my situation because I still need to assign a static IP address to the container (system architectural constraint).
I suspect that either my Docker network configuration, my host routing table, or both are not quite right.
My Configuration
The docker-compose file I use to demonstrate this problem is as follows:
version: '3.1'
services:
my_container:
container_name: pc1-a
hostname: pc1-a
image: my-image
privileged: true
stdin_open: true
tty: true
command: /bin/bash
# network_mode: host
networks:
system_net:
ipv4_address: 192.168.127.102
cam1_net:
ports:
- "8022:22"
networks:
system_net:
driver: macvlan
driver_opts:
parent: eth6
ipam:
config:
- subnet: 192.168.127.0/24
gateway: 192.168.127.1
ip_range: 192.168.127.96/28
aux_addresses:
host: 192.168.127.101
cam1_net:
driver: ipvlan
driver_opts:
parent: eth1
ipam:
config:
- subnet: 192.168.11.0/24
gateway: 192.168.11.1
ip_range: 192.168.11.0/28
aux_addresses:
dev: 192.168.11.11
host: 192.168.11.10
The host machine runs Ubuntu 20.04 and my Docker image is a standard-ish Ubuntu 20.04 image with the Pleora driver installed.
Any thoughts out there?