CAN network plugin provides ability to create CAN bus networks for Docker containers.
1.4K
CAN network plugin provides ability to create CAN bus networks for Docker containers.
It is based on original code from https://gitlab.com/chgans/can4docker, with some (minor) updates and fixes.
Current repository hosted here: https://github.com/wsovalle/docker-vxcan
Plugin doesn't need any specific steps to install, although it depends on kernel modules (available out-of-the-box in Ubuntu 20.04)
$ sudo modprobe vxcan
$ sudo modprobe can-gw
$ docker plugin install wsovalle/vxcan
This plugin fully supports docker-compose, eg.:
version: "3"
services:
app_hub:
image: ubuntu:20.04
tty: true
networks:
- canbus0
- canbus1
app_can0:
image: ubuntu:20.04
tty: true
networks: [ canbus0 ]
app_can1:
image: ubuntu:20.04
tty: true
networks: [ canbus1 ]
networks:
canbus0:
driver: wsovalle/vxcan:latest
driver_opts:
vxcan.dev: can_host
vxcan.peer: can_docker
vxcan.id: 0
canbus1:
driver: wsovalle/vxcan:latest
driver_opts:
vxcan.dev: can_host
vxcan.peer: can_docker
vxcan.id: 1
$ docker-compose up
On network level (docker network create --opts ):
vxcan.dev - CAN interface name on host, in example can_hostXvxcan.id - interface enumeration on host, in example can_host0 for canbus0 and can_host1 for canbus1vxcan.peer - CAN interface name in a container, in example can_dockerX, where X is automatic enumeration provided by dockerEndpoint level (docker network connect --driver-opts , not supported by compose):
vxcan.peer - CAN interface name in a containerSimple way of rebuilding plugin from sources is to use an attached script:
$ images/docker-plugin/rebuild-plugin.sh
It removes existing plugin, rebuilds from sources and enables freshly built version.
For separate steps refer to the contents of above script.
Links to resources used while creating and fixing this plugin
Content type
Plugin
Digest
Size
18.5 MB
Last updated
over 4 years ago
docker plugin install jhaws1982/vxcan