diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index 45152699b3a59e713f7ba5835a6c29bd734be822..0000000000000000000000000000000000000000 --- a/Dockerfile +++ /dev/null @@ -1,16 +0,0 @@ -# The host exposes the virtual interface vcan0: -# https://stackoverflow.com/questions/21022749/how-to-create-virtual-can-port-on-linux-c -# sudo modprobe vcan -# sudo ip link add dev vcan0 type vcan -# sudo ip link set up vcan0 - -FROM ubuntu:20.04 - -RUN apt-get update -y -RUN apt-get install can-utils - -# For the moment, expose the host network to the container for vcan0 visibility -# https://www.lagerdata.com/articles/forwarding-can-bus-traffic-to-a-docker-container-using-vxcan-on-raspberry-pi -CMD cangen vcan0 - -# On the host system, run 'candump vlan0' command to capture generated CAN traffic diff --git a/Makefile b/Makefile index 84a473994694e98d990c6a6de6d84dc54f45ad98..ecbc7ac891427b1e211f8d4d78607c23de9a40bc 100644 --- a/Makefile +++ b/Makefile @@ -2,6 +2,7 @@ registry=gitlab.cs.pub.ro:5050/reaact/can-container img_name=can-container tag_name=${registry} +# TODO: Update makefile build: docker image build -t ${tag_name} . diff --git a/can.Dockerfile b/can.Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..4586558da6f0bfa24c9c13cddcc223cb1d00dea5 --- /dev/null +++ b/can.Dockerfile @@ -0,0 +1,13 @@ +# The host exposes the virtual interface vcan0: +# https://stackoverflow.com/questions/21022749/how-to-create-virtual-can-port-on-linux-c +# sudo modprobe vcan +# sudo ip link add dev vcan0 type vcan +# sudo ip link set up vcan0 + +FROM ubuntu:20.04 + +RUN apt-get update -y +RUN apt-get install can-utils + +# Keep the container running +CMD tail -f /dev/null diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000000000000000000000000000000000000..78f3def7de820fb3b95b551da3828cbf88f4825a --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,14 @@ +version: "3.3" +services: + eth: + build: + context: . + dockerfile: ./eth.Dockerfile + network_mode: "host" + privileged: true + can: + build: + context: . + dockerfile: ./can.Dockerfile + network_mode: "host" + privileged: true diff --git a/eth.Dockerfile b/eth.Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..2c18e3786b3284e91d690683e67e142313043fc6 --- /dev/null +++ b/eth.Dockerfile @@ -0,0 +1,12 @@ +FROM ubuntu:20.04 + +RUN apt-get update +RUN DEBIAN_FRONTEND=noninteractive TZ=Europe/Bucharest apt-get -y install tzdata +RUN apt-get -y install iproute2 +RUN apt-get -y install netsniff-ng + +# Dummy trafgen config +RUN echo "{ fill(0xff, 64) csum16(0, 64) }" > trafgen.cfg + +# Keep the container running +CMD tail -f /dev/null