Skip to main content

Network configuration

RemotiveBus networks are configured as Docker networks. The type attribute determines what kind of network is created.

  • can: For connecting to physical CAN devices
  • vcan: For creating virtual CAN devices
  • vlan: For creating Ethernet networks with 802.1Q tags

CAN networks

CAN networks connect containers to CAN buses, either physical hardware or virtual buses.

Connect a container to a physical CAN interface

Use type: can to give a container access to an existing SocketCAN interface on the host which may be connected to physical device.

type: can
device: mybus
host_device: myhostbus # Name of the SocketCAN device on the host
baudrate: 500000 # Optional: applied if the device was down
baudrate_fd: 2000000 # Optional: applied if the device was down
txqueuelen: 1000 # Optional: override the TX queue length

Create a virtual CAN bus between containers

Use type: vcan without a host_device to create an isolated virtual CAN bus that's only accessible inside Docker containers.

type: vcan
device: mybus

Bridge a virtual CAN bus to the host

Adding host_device creates a virtual CAN interface on the host as well, so the traffic is accessible from outside Docker containers.

type: vcan
device: mybus
host_device: myhostbus # Name of the virtual CAN interface to create on the host

Bridge with a RemotiveBus plugin

Plugins can be notified when a VCAN network is created or torn down. This is used for things like bridging CAN traffic to external hardware.

type: vcan
device: mybus
host_device: myhostbus
plugin.driver: kvaser # Plugin ID — must match the plugin's socket name

See the Plugins page for details on how plugins work.

CAN configuration options

type: can

OptionDescription
deviceName of the CAN interface inside the container. Docker appends a trailing 0 to this name.
host_deviceName of the SocketCAN device on the host to connect to.
baudrateCAN baud rate. Applied only if the device was down at startup.
baudrate_fdCAN-FD baud rate. Applied only if the device was down at startup.
txqueuelenTX queue length override for the network interface.

type: vcan

OptionDescription
deviceName of the CAN interface inside the container. Docker appends a trailing 0 to this name.
host_device(Optional) Name of the virtual CAN interface to create on the host.
plugin.driver(Optional) ID of a RemotiveBus plugin to notify on network create/destroy.
plugin.*(Optional) Additional options passed to the plugin.

VLAN networks

VLAN networks provide Ethernet connectivity to containers using 802.1Q VLAN tags.

Containers receive a trunk interface that carries tagged VLAN traffic as well as VLAN subinterfaces (e.g. eth0.100) that strip VLAN tags so the container sees plain Ethernet frames.

Connect a container to a VLAN

The most basic case: a container joins a specific VLAN as an access port. The container sees plain Ethernet frames with no VLAN tags on the subinterface.

type: vlan
vlan_id: 10 # VLAN ID (1–4094)
device: eth0.10 # Interface name inside the container
host_bridge_device: rb0 # Bridge name on the host (created automatically)
note

The bridge specified by host_bridge_device is created automatically by RemotiveBus. If a bridge with that name already exists on the host (for example, created manually or by another tool), network creation fails.

Connect a VLAN to a physical network interface

To allow VLAN traffic to flow to or from the physical network, specify one or more host interfaces with host_physical_device.

type: vlan
vlan_id: 10
device: eth0.10
host_bridge_device: rb0
host_physical_device: "eth1" # Single physical interface
# or:
host_physical_device: "eth1,eth2" # Multiple interfaces (comma-separated)

Multiple VLAN networks on the same bridge

Multiple VLAN networks can share the same bridge by using the same host_bridge_device name. Each VLAN is isolated from the others.

# VLAN 10
type: vlan
vlan_id: 10
device: eth0.10
host_bridge_device: rb0

# VLAN 20
type: vlan
vlan_id: 20
device: eth0.20
host_bridge_device: rb0

Raw trunk mode (container handles VLAN tagging)

By default, containers receive both a trunk interface carrying all tagged VLAN traffic and a VLAN subinterface for each VLAN id. If a container needs to handle 802.1Q VLAN tags itself (for example, a debug tool or a container running its own VLAN logic), set create_vlan_interface: "false" in the container's driver_opts and the subinterfaces won't be created.

This is a per-container option set at join time, not a network-level option. Different containers on the same network can use different modes.

services:
mycontainer:
networks:
vlan10:
driver_opts:
create_vlan_interface: "false" # Container still receives raw 802.1Q frames

VLAN configuration options

Network creation options

OptionDescription
deviceInterface name inside the container.
vlan_idVLAN ID for this network (1–4094).
host_bridge_deviceBridge name on the host (max 15 characters).
host_physical_device(Optional) Physical host interface to attach to the bridge. Accepts a single name or a comma-separated list (e.g. "eth1" or "eth1,eth2").

Per-container join-time options (set in driver_opts)

OptionDescription
device(Optional) Override the interface name inside this specific container.
create_vlan_interface(Optional) Set to "false" to skip creating a VLAN subinterface. Default: "true".