My questions has two parts:-
- Is it possible to create a virtual CAN interface as a network device or driver on host, like a bridge
- After creating then sharing this virtual CAN b/w two docker containers so that they can send/receive the data on the same interface?
It is even possible to do it now by doing the following steps:-
- On host run the following commands to bring up virtual CAN via iproute2 ip utility:
$ sudo modprobe vcan
$ sudo ip link add dev vcan0 type vcan
$ sudo ip link set up vcan0
- Running the first container via:-
$ docker run --rm -it --network=host debian:stretch
root@deb123:/# apt update && apt install can-utils
root@deb123:/# candump vcan0
- Running the second container in another command window via:-
$ docker run --rm -it --network=host debian:stretch
root@deb123:/# apt update && apt install can-utils
root@deb123:/# cansend vcan0 180#01000000
- In the first container, we get the CAN message from second container:-
root@deb123:/# candump vcan0
vcan0 180 [4] 01 00 00 00
The only problem is there is no network isolation b/w docker host and containers anymore. Is there a way to achieve the above but without sharing the host network