{"id":13471438,"url":"https://github.com/containernet/containernet","last_synced_at":"2025-03-26T13:31:04.633Z","repository":{"id":11986373,"uuid":"70905895","full_name":"containernet/containernet","owner":"containernet","description":"Mininet fork adding support for container-based (e.g. Docker) emulated hosts.","archived":false,"fork":false,"pushed_at":"2024-09-23T12:19:47.000Z","size":5895,"stargazers_count":393,"open_issues_count":28,"forks_count":200,"subscribers_count":12,"default_branch":"master","last_synced_at":"2024-10-30T02:59:41.728Z","etag":null,"topics":["container","containernet","docker","emulation","mininet","networking"],"latest_commit_sha":null,"homepage":"https://containernet.github.io","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/containernet.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-10-14T11:55:30.000Z","updated_at":"2024-10-24T02:00:48.000Z","dependencies_parsed_at":"2023-01-11T20:17:21.622Z","dependency_job_id":"d829428a-3551-4ab9-a2e5-1fdd73372581","html_url":"https://github.com/containernet/containernet","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/containernet%2Fcontainernet","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/containernet%2Fcontainernet/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/containernet%2Fcontainernet/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/containernet%2Fcontainernet/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/containernet","download_url":"https://codeload.github.com/containernet/containernet/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245662795,"owners_count":20652085,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["container","containernet","docker","emulation","mininet","networking"],"created_at":"2024-07-31T16:00:44.892Z","updated_at":"2025-03-26T13:31:04.200Z","avatar_url":"https://github.com/containernet.png","language":"Python","funding_links":[],"categories":["Uncategorized","Python"],"sub_categories":["Uncategorized"],"readme":"# Containernet\n\n\u003cimg align=\"left\" width=\"200\" height=\"200\" style=\"margin: 30px 30px 0 0;\" src=\"/assets/logo.png\" /\u003e\n\nContainernet is a fork of the famous [Mininet](http://mininet.org) network emulator and allows to use [Docker](https://www.docker.com) containers as hosts in emulated network topologies. This enables interesting functionalities to build networking/cloud emulators and testbeds. Containernet is actively used by the research community, focussing on experiments in the field of cloud computing, fog computing, network function virtualization (NFV) and multi-access edge computing (MEC). One example for this is the [NFV multi-PoP infrastructure emulator](https://github.com/sonata-nfv/son-emu) which was created by the SONATA-NFV project and is now part of the [OpenSource MANO (OSM)](https://osm.etsi.org) project.\n\n## Features\n\n- Add, remove Docker containers to Mininet topologies\n- Connect Docker containers to topology (to switches, other containers, or legacy Mininet hosts)\n- Execute commands inside containers by using the Mininet CLI\n- Dynamic topology changes\n  - Add hosts/containers to a _running_ Mininet topology\n  - Connect hosts/docker containers to a _running_ Mininet topology\n  - Remove Hosts/Docker containers/links from a _running_ Mininet topology\n- Resource limitation of Docker containers\n  - CPU limitation with Docker CPU share option\n  - CPU limitation with Docker CFS period/quota options\n  - Memory/swap limitation\n  - Change CPU/mem limitations at runtime!\n- Expose container ports and set environment variables of containers through Python API\n- Traffic control links (delay, bw, loss, jitter)\n- Automated installation based on Ansible playbook\n\n## Installation\n\nContainernet comes with two installation and deployment options.\n\n### Option 1: Bare-metal installation\n\nThis option is the most flexible. Your machine should run at least Ubuntu **22.04 LTS** and **Python3**.\n\nFirst install Ansible:\n\n```bash\nsudo apt-get install ansible\n```\n\nThen clone the repository:\n\n```bash\ngit clone https://github.com/containernet/containernet.git\n```\n\nRun the Ansible playbook to install required dependencies:\n\n```bash\nsudo ansible-playbook -i \"localhost,\" -c local containernet/ansible/install.yml\n```\n\nFinally, install Containernet inside a virtual env. Installing Containernet as root is not possible anymore starting from Ubuntu 24.04 and does not work on Ubuntu 22.04 because of [a setuptools issue](https://github.com/pypa/setuptools/issues/4483)\n\n```bash\npython3 -m venv venv\nsource venv/bin/activate\n# If you want to install containernet in \"edit\" mode\npip install -e . --no-binary :all:\n# If you want to install containernet in \"normal\" mode\npip install .\n```\n\nAfter the installation finishes, you should be able to [get started](#get-started).\n\n### Option 2: Nested Docker deployment\n\nContainernet can be executed within a privileged Docker container (nested container deployment). There is also a pre-build Docker image available on [Docker Hub](https://hub.docker.com/r/containernet/containernet/).\n\n**Attention:** Container resource limitations, e.g. CPU share limits, are not supported in the nested container deployment. Use bare-metal installations if you need those features.\n\nYou can build the container locally:\n\n```bash\ndocker build -t containernet/containernet .\n```\n\nor alternatively pull the latest pre-build container:\n\n```bash\ndocker pull containernet/containernet\n```\n\nYou can then directly start the default containernet example:\n\n```bash\ndocker run --name containernet -it --rm --privileged --pid='host' --net='host' -v /var/run/docker.sock:/var/run/docker.sock containernet/containernet\n```\n\nor run an interactive container and drop to the shell:\n\n```bash\ndocker run --name containernet -it --rm --privileged --pid='host' --net='host' -v /var/run/docker.sock:/var/run/docker.sock containernet/containernet /bin/bash\n```\n\nIf the container takes a very long time to create controllers, then you can try adding `--ulimit nofile=524288:524288` to the docker command. The issue is that mnexec.c tries to close all possibly open file descriptors, which may be set to a very high value. The nofile in the container does not even have to match the nofile value of the host shell.\n\n## Get started\n\nUsing Containernet is very similar to using Mininet.\n\n### Running a basic example\n\nMake sure you are in the `containernet` directory. You can start an example topology with some empty Docker containers connected to the network:\n\n```bash\nsudo python3 examples/containernet_example.py\n```\n\nWith the recent update to Ubuntu 24.04, Containernet has to be installed and used in a venv. However, Mininet still requires root rights. You can start your topologies with:\n```bash\nsudo -E env PATH=$PATH python3 examples/containernet_example.py\n```\n\nAfter launching the emulated network, you can interact with the involved containers through Mininet's interactive CLI. You can for example:\n\n- use `containernet\u003e d1 ifconfig` to see the config of container `d1`\n- use `containernet\u003e d1 ping -c4 d2` to ping between containers\n\nYou can exit the CLI using `containernet\u003e exit`.\n\n### Running a client-server example\n\nLet's simulate a webserver and a client making requests. For that, we need a server and client image.\nFirst, change into the `containernet/examples/basic_webserver` directory.\n\nContainernet already provides a simple Python server for testing purposes. To build the server image, just run\n\n```bash\ndocker build -f Dockerfile.server -t test_server:latest .\n```\n\nIf you have not added your user to the `docker` group as described [here](https://docs.docker.com/engine/install/linux-postinstall/), you will need to prepend `sudo`. \n\nWe further need a basic client to make a CURL request. Containernet provides that as well. Please run\n\n```bash\ndocker build -f Dockerfile.client -t test_client:latest .\n```\n\nNow that we have a server and client image, we can create hosts using them. You can either checkout the topology\nscript `demo.py` first or run it directly:\n\n```bash\nsudo python3 demo.py\n```\n\nIf everything worked, you should be able to see following output:\n\n```txt\nExecute: client.cmd(\"time curl 10.0.0.251\")\nHello world.\n```\n\n### Customizing topologies\n\nYou can also add hosts with resource restrictions or mounted volumes:\n\n```python\n# ...\n\nd1 = net.addDocker('d1', ip='10.0.0.251', dimage=\"ubuntu:trusty\")\nd2 = net.addDocker('d2', ip='10.0.0.252', dimage=\"ubuntu:trusty\", cpu_period=50000, cpu_quota=25000)\nd3 = net.addHost('d3', ip='11.0.0.253', cls=Docker, dimage=\"ubuntu:trusty\", cpu_shares=20)\nd4 = net.addDocker('d4', dimage=\"ubuntu:trusty\", volumes=[\"/:/mnt/vol1:rw\"])\n\n# ...\n```\n\n## Documentation\n\nContainernet's documentation can be found in the [GitHub wiki](https://github.com/containernet/containernet/wiki). The documentation for the underlying Mininet project can be found on the [Mininet website](http://mininet.org/).\n\n## Research\n\nContainernet has been used for a variety of research tasks and networking projects. If you use Containernet, let us know!\n\n### Cite this work\n\nIf you use Containernet for your work, please cite the following publication:\n\nM. Peuster, H. Karl, and S. v. Rossem: [**MeDICINE: Rapid Prototyping of Production-Ready Network Services in Multi-PoP Environments**](http://ieeexplore.ieee.org/document/7919490/). IEEE Conference on Network Function Virtualization and Software Defined Networks (NFV-SDN), Palo Alto, CA, USA, pp. 148-153. doi: 10.1109/NFV-SDN.2016.7919490. (2016)\n\nBibtex:\n\n```bibtex\n@inproceedings{peuster2016medicine,\n    author={M. Peuster and H. Karl and S. van Rossem},\n    booktitle={2016 IEEE Conference on Network Function Virtualization and Software Defined Networks (NFV-SDN)},\n    title={MeDICINE: Rapid prototyping of production-ready network services in multi-PoP environments},\n    year={2016},\n    volume={},\n    number={},\n    pages={148-153},\n    doi={10.1109/NFV-SDN.2016.7919490},\n    month={Nov}\n}\n```\n\n### Publications\n\n- M. Peuster, H. Karl, and S. v. Rossem: [MeDICINE: Rapid Prototyping of Production-Ready Network Services in Multi-PoP Environments](http://ieeexplore.ieee.org/document/7919490/). IEEE Conference on Network Function Virtualization and Software Defined Networks (NFV-SDN), Palo Alto, CA, USA, pp. 148-153. doi: 10.1109/NFV-SDN.2016.7919490. IEEE. (2016)\n\n- S. v. Rossem, W. Tavernier, M. Peuster, D. Colle, M. Pickavet and P. Demeester: [Monitoring and debugging using an SDK for NFV-powered telecom applications](https://biblio.ugent.be/publication/8521281/file/8521284.pdf). IEEE Conference on Network Function Virtualization and Software Defined Networks (NFV-SDN), Palo Alto, CA, USA, Demo Session. IEEE. (2016)\n\n- Qiao, Yuansong, et al. [Doopnet: An emulator for network performance analysis of Hadoop clusters using Docker and Mininet.](http://ieeexplore.ieee.org/document/7543832/) Computers and Communication (ISCC), 2016 IEEE Symposium on. IEEE. (2016)\n\n- M. Peuster, S. Dräxler, H. Razzaghi, S. v. Rossem, W. Tavernier and H. Karl: [A Flexible Multi-PoP Infrastructure Emulator for Carrier-grade MANO Systems](https://cs.uni-paderborn.de/fileadmin/informatik/fg/cn/Publications_Conference_Paper/Publications_Conference_Paper_2017/peuster_netsoft_demo_paper_2017.pdf). In IEEE 3rd Conference on Network Softwarization (NetSoft) Demo Track . (2017) **Best demo award!**\n\n- M. Peuster and H. Karl: [Profile Your Chains, Not Functions: Automated Network Service Profiling in DevOps Environments](http://ieeexplore.ieee.org/document/8169826/). IEEE Conference on Network Function Virtualization and Software Defined Networks (NFV-SDN), Berlin, Germany. IEEE. (2017)\n\n- M. Peuster, H. Küttner and H. Karl: [Let the state follow its flows: An SDN-based flow handover protocol to support state migration](https://ris.uni-paderborn.de/publication/3345). In IEEE 4th Conference on Network Softwarization (NetSoft). IEEE. (2018) **Best student paper award!**\n\n- M. Peuster, J. Kampmeyer and H. Karl: [Containernet 2.0: A Rapid Prototyping Platform for Hybrid Service Function Chains](https://ris.uni-paderborn.de/publication/3346). In IEEE 4th Conference on Network Softwarization (NetSoft) Demo, Montreal, Canada. (2018)\n\n- M. Peuster, M. Marchetti, G. García de Blas, H. Karl: [Emulation-based Smoke Testing of NFV Orchestrators in Large Multi-PoP Environments](https://ris.uni-paderborn.de/publication/3347). In IEEE European Conference on Networks and Communications (EuCNC), Lubljana, Slovenia. (2018)\n\n- S. Schneider, M. Peuster,Wouter Tvernier and H. Karl: [A Fully Integrated Multi-Platform NFV SDK](https://ris.uni-paderborn.de/record/6974). In IEEE Conference on Network Function Virtualization and Software Defined Networks (NFV-SDN) Demo, Verona, Italy. (2018)\n\n- M. Peuster, S. Schneider, Frederic Christ and H. Karl: [A Prototyping Platform to Validate and Verify Network Service Header-based Service Chains](https://ris.uni-paderborn.de/record/6483). In IEEE Conference on Network Function Virtualization and Software Defined Networks (NFV-SDN) 5GNetApp, Verona, Italy. (2018)\n\n- S. Schneider, M. Peuster and H. Karl: [A Generic Emulation Framework for Reusing and Evaluating VNF Placement Algorithms](https://ris.uni-paderborn.de/record/6972). In IEEE Conference on Network Function Virtualization and Software Defined Networks (NFV-SDN), Verona, Italy. (2018)\n\n- M. Peuster, S. Schneider, D. Behnke, M. Müller, P-B. Bök, and H. Karl: [Prototyping and Demonstrating 5G Verticals: The Smart Manufacturing Case](https://ris.uni-paderborn.de/record/8792). In IEEE 5th Conference on Network Softwarization (NetSoft) Demo, Paris, France. (2019)\n\n- M. Peuster, M. Marchetti, G. Garcia de Blas, Holger Karl: [Automated testing of NFV orchestrators against carrier-grade multi-PoP scenarios using emulation-based smoke testing](https://ris.uni-paderborn.de/record/10325). In EURASIP Journal on Wireless Communications and Networking (2019)\n\n## Other projects and links\n\nThere is an extension of Containernet called [vim-emu](https://github.com/containernet/vim-emu) which is a full-featured multi-PoP emulation platform for NFV scenarios. Vim-emu was developed as part of the [SONATA-NFV](http://www.sonata-nfv.eu) project and is now hosted by the [OpenSource MANO project](https://osm.etsi.org/):\n\n\u003cp align=\"center\"\u003e\n    \u003ca href=\"https://osm.etsi.org/wikipub/index.php/Research\" target=\"_blank\"\u003e\n        \u003cimg align=\"center\" width=\"200\" src=\"/assets/osm_ecosystem_research.png\"\u003e\n    \u003c/a\u003e\n\u003c/p\u003e\n\nFor running Mininet or Containernet distributed in a cluster, checkout [Maxinet](http://maxinet.github.io).\n\nYou can also find an alternative/teaching-focused approach for Container-based Network Emulation by TU Dresden in [their repository](https://git.comnets.net/public-repo/comnetsemu).\n\n## Contact\n\n### Support\n\nIf you have any questions, please use GitHub's [issue system](https://github.com/containernet/containernet/issues).\n\n### Contribute\n\nYour contributions are very welcome! Please fork the GitHub repository and create a pull request.\n\nPlease make sure to test your code using\n\n```bash\nsudo make test\n```\n\n### Lead developer\n\nManuel Peuster\n\n- Mail: \u003cmanuel (at) peuster (dot) de\u003e\n- Twitter: [@ManuelPeuster](https://twitter.com/ManuelPeuster)\n- GitHub: [@mpeuster](https://github.com/mpeuster)\n- Website: [https://peuster.de](https://peuster.de)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcontainernet%2Fcontainernet","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcontainernet%2Fcontainernet","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcontainernet%2Fcontainernet/lists"}