January 2019
Beginner to intermediate
776 pages
19h 58m
English
In this recipe, we will attach existing containers to our simple network emulation. To avoid creating Docker images on our own, as it is out of scope for this book, we will use the example included in the Containernet Vagrant image.
Docker containers can be initialized in place of hosts and switches as nodes in constructing the links. Various parameters and the volumes that define the container can be specified.
Listing 9.5 gives a simple emulation of a network with containers as follows:
#!/usr/bin/env python # Python Network Programming Cookbook, Second Edition -- Chapter - 9 # This program is optimized for Python 2.7.12. # It may run on any other version with/without modifications. # Adopted from https://github.com/containernet/containernet/blob/master/examples/dockerhosts.py ...
Read now
Unlock full access