Skip to content

CANbus Docker

You can run the Edge Xrt CANbus Device Service in a docker container.

The following examples use the iotechsys/xrt:2.1 docker image.

You can run the Edge Xrt docker container on either of the following networks:

  • Host
  • Docker bridge

Run on Host Network

In the following example xrt-canbus provides the name of the running container, <deployment_directory> provides the location of the config, state and profiles folders. [time_in_seconds] can optionally define the time for which Edge Xrt is to run in seconds:

docker run --rm --network=host --name xrt-canbus -v <deployment_directory>/deployment:/opt/iotech/xrt/2.1/deployment iotechsys/xrt:2.1 [time_in_seconds]

Run on Docker Bridge Network

When running the CANbus Service on a Docker bridge network and connecting to a CAN network that is not running on the same network the container needs to be run as privileged and the following volumes need to be mounted into the Docker container:

--mount type=bind,source=/proc/1/ns,target=/rootns/
-v /sys/:/sys/

In the following example command the network flag is set to <docker_bridge_network>, specifying the docker network to connect to, xrt-canbus provides the name of the running container, <deployment_directory> provides the location of the config folder, and [time_in_seconds] can optionally define the time for which Edge Xrt is to run in seconds:

docker run --rm --name xrt-canbus --mount type=bind,source=/proc/1/ns,target=/rootns/ \
  -v <deployment_directory>/deployment:/opt/iotech/xrt/2.1/deployment -v /sys/:/sys/ \
  --network <docker_bridge_network> iotechsys/xrt:2.1 [timeout in secs]

Note

If the network flag is not included in the command, the default bridge network is used.