This Docker image provides a Mininet simulation environment integrated with the RYU SDN controller. It allows you to easily set up and run network simulations using Mininet and manage them with RYU.
To build locally, git clone to the repository and use the following command:
sudo docker build -t 601199/mininet-ryu .Alternatively, to pull the Docker image from DockerHub, use the following command:
sudo docker pull 601199/mininet-ryuTo run the Docker container, use the following command:
sudo docker run -it --rm --privileged -e DISPLAY \
-v /tmp/.X11-unix:/tmp/.X11-unix \
-v /lib/modules:/lib/modules \
-v /[path-to-files]:/home \
601199/mininet-ryuIn the above command:
- --rm: Automatically remove the container when it exits.
- --privileged: Grants extended privileges to the container.
- -e DISPLAY: Passes the DISPLAY environment variable for GUI applications.
- -v /tmp/.X11-unix:/tmp/.X11-unix: Shares the host's X11 display server with the container.
- -v /lib/modules:/lib/modules: Shares the host's kernel modules with the container.
- -v /[path-to-files]:/home: Maps the specified host directory to the /home directory in the container. This directory can include your Mininet topology custom files and RYU controller app files.
Inside the Docker container, navigate to the RYU directory and start the RYU controller with the following commands:
cd ryu
PYTHONPATH=. ./bin/ryu-manager ryu.app.simple_switch_13This command starts the default simple_switch_13 application. If you have a custom controller file, you can copy it to the RYU app directory and then run it:
cp /home/my_controller.py /root/ryu/ryu/app
PYTHONPATH=. ./bin/ryu-manager ryu.app.my_controllerTo open another shell in the running Docker container:
- In your host OS, list the running Docker containers to get the container ID:
sudo docker ps- Use the container ID to open a new shell in the running container:
sudo docker exec -it <container-id> bashIn the new Docker shell, navigate to the directory containing your Mininet custom topology file and run it:
cd /home/
mn --custom my_topo.pyBy following these steps, you can:
- Pull the Docker image: Get the pre-built Docker image from DockerHub.
- Run the Docker container: Start the container with the necessary permissions and folder mappings.
- Run the RYU controller: Start the default or custom RYU applications.
- Access the running container: Open additional shells in the container to run more commands.
- Run Mininet topologies: Execute your custom Mininet topology files within the Docker container.
- This setup simplifies the process of running network simulations using Mininet and managing them with the RYU controller. Enjoy your network simulation environment!