8 for cnt in $(seq 1 ${2:-1}); do
9 docker network create --driver bridge csit-nw-tg${cnt} || true
10 # If the IMAGE is not already loaded then docker run will pull the
11 # IMAGE, and all image dependencies, before it starts the container.
12 dcr_image="base-ubuntu2204:local"
13 # Run the container in the background and print the new container
15 dcr_stc_params="--detach=true "
16 # Give extended privileges to this container. A "privileged"
17 # container is given access to all devices and able to run nested
19 dcr_stc_params+="--privileged "
20 # Publish all exposed ports to random ports on the host interfaces.
21 dcr_stc_params+="--publish 600${cnt}:2222 "
22 # Automatically remove the container when it exits.
23 dcr_stc_params+="--rm "
25 dcr_stc_params+="--shm-size 4G "
26 # Mount vfio to be able to bind to see binded interfaces. We cannot
27 # use --device=/dev/vfio as this does not see newly binded
29 dcr_stc_params+="--volume /dev:/dev "
30 # Mount /opt/boot/ where VM kernel and initrd are located.
31 dcr_stc_params+="--volume /opt:/opt "
32 # Mount host hugepages for VMs.
33 dcr_stc_params+="--volume /dev/hugepages:/dev/hugepages "
35 params=(${dcr_stc_params} --name csit-tg-"${cnt}" "${dcr_image}")
36 docker run --network=csit-nw-tg${cnt} "${params[@]}"
40 docker rm --force $(docker ps --all --quiet --filter name=csit)
41 docker network rm $(docker network ls --filter name=csit --quiet)