A comprehensive Docker container for running Mininet network emulation with sample topologies and demonstrations.
- Updated Base: Ubuntu 24.04 with latest Mininet
- Pre-built Demos: Multiple topology examples and use cases
- Performance Testing: Built-in iperf3 for network performance analysis
- Web Server Demo: HTTP server examples
- Easy Setup: Docker Compose support for quick deployment
# Clone the repository
git clone https://github.com/prashplus/mininet-docker.git
cd mininet-docker
# Start the container
docker-compose up -d
# Access the container (alternative methods)
docker-compose exec mininet bash
# OR if the above doesn't work:
docker exec -it mininet-demo bash# Clone the repository
git clone https://github.com/prashplus/mininet-docker.git
cd mininet-docker
# Build the image
docker build -t mininet-demo .
# Run the container with required privileges
docker run --name mininet-demo --privileged -it \
-p 8000:8000 -p 8080:8080 -p 6633:6633 \
mininet-demodocker pull prashplus/mininet-docker
docker run --name mininet-demo --privileged -it \
-p 8000:8000 -p 8080:8080 -p 6633:6633 \
prashplus/mininet-dockerOnce inside the container, you can run various pre-built demonstrations:
python3 /root/demos/simple_topology.pypython3 /root/demos/linear_topology.pypython3 /root/demos/tree_topology.pypython3 /root/demos/webserver_demo.pypython3 /root/demos/performance_test.pypython3 /root/demos/sdn_demo.py# Start basic mininet with default topology
mn
# Create a specific topology
mn --topo single,3 # Single switch with 3 hosts
mn --topo linear,4 # Linear topology with 4 switches
mn --topo tree,3 # Tree topology with depth 3
# Test connectivity
mininet> pingall
# Run iperf test
mininet> iperf h1 h2
# Open terminal on specific host
mininet> xterm h1
# Exit mininet
mininet> exit# Start with remote controller
mn --controller=remote,ip=127.0.0.1,port=6633
# Custom link parameters
mn --link tc,bw=10,delay=10ms
# Enable CLI with custom topology
mn --custom /root/demos/simple_topology.py --topo mytopo# Inside mininet CLI
pingall # Test all-to-all connectivity
h1 ping h2 # Ping between specific hosts# Inside mininet CLI
iperf h1 h2 # TCP bandwidth test
iperf h1 h2 -u # UDP bandwidth test# On host h1 (inside mininet)
h1 python3 -m http.server 8000 &
# On host h2
h2 curl http://10.0.0.1:8000- Permission Denied: Make sure to run with
--privilegedflag - Port Conflicts: Check if ports 6633, 8000, 8080 are available
- OVS Issues: The container automatically starts Open vSwitch
- Service not running: If
docker-compose execfails, trydocker exec -it mininet-demo bash
# If docker-compose exec doesn't work, try:
docker exec -it mininet-demo bash
# Check if container is running:
docker ps
# Restart the container:
docker-compose down && docker-compose up -d
# Build and start fresh:
docker-compose down && docker-compose build && docker-compose up -d# Check OVS status
ovs-vsctl show
# View network interfaces
ip link show
# Check running processes
ps aux | grep mininet- Create a new Python file in the
demos/directory - Follow the existing examples for structure
- Rebuild the container or mount the volume
# Edit Dockerfile for permanent changes
# Or mount volumes for development:
docker run --privileged -it \
-v $(pwd)/demos:/root/demos \
-v $(pwd)/script:/root/script \
mininet-demo- Base Image: Ubuntu 24.04
- Mininet Version: Latest stable
- Python Version: 3.12+
- Open vSwitch: Latest stable
- Additional Tools: iperf3, tcpdump, curl, vim
8000: HTTP server demos8080: Alternative HTTP port6633: OpenFlow controller port6653: Secure OpenFlow port
- Fork the repository
- Create a feature branch
- Add your improvements
- Submit a pull request
- Prashant Piprotar - Prash+
Visit my blog for more tech content: http://www.prashplus.com
This project is licensed under the MIT License - see the LICENSE file for details.