Reference Guide

This document describes the details of the commands and data structures that make up the containers system. The User Guide /Tutorial provides useful context about the workflows and goals of the system that inform these technical details.


This describes the command line interface to the containers system.

The command creates a DETER experiment made up of containers. The program is available from /share/containers/ on A sample invocation is:

$ /share/containers/ MyProject MyExperiment ~/mytopology.tcl

It will create a new experiment in MyProject called MyExperiment containing the experiment topology in mytopology.tcl. All the topology creation commands supported by DETER are supported by the conatainerization system, but emulab/DETER program agents are not. Emulab/DETER start commands are supported.

Containers will create an experiment in a group if the project parameter is of the form project/group. To start an experiment in the testing group of the DETER project, the first parameter is specified as DETER/testing.

Either an ns2 file or a topdl description is supported. Ns2 descriptions must end with .tcl or .ns. Other files are assumed to be topdl descriptions.

Names of substrates and nodes in ns2 files are restricted to valid tcl variable names. Names of substrates and nodes in topdl files are restricted to the characters A-Z, a-z, digits, the underscore and the hyphen (-).

By default, program will partition the topology into openvz containers, packed 10 containers per physical computer. If the topology is already partitioned - at least one element has a conatiners::partition atttribute - will not partition it. The --force-partition flag causes to partition the experiment regardless of the presence of containers:partition attributes.

If container types have been assigned to nodes using the containers:node_type attribute, will respect them. Valid container types for the containers:node_type attribute or the --default-container parameter are:

Parameter Container
embedded_pnode Physical Node
qemu Qemu VM
openvz Openvz Container
process ViewOS process

The command takes several parameters that can change its behavior:

Containerize nodes without a container type into kind. If no nodes have been assigned containers, this puts all them into kind containers.
Partition the experiment whether or not it has been paritioned already
Attempt to put int containers into each physical node. The default --packing is 10.
Attempt to the experiment into int physical nodes. The default to use packing. There are some nuances to this with mixed containers. See the users guide for more details.
Read configuration variables from filename the configuration values are discussed below.
Override the site configuration and request nodes of type1 (or type2 etc.) as host nodes.
Attempt to do end node traffic shaping even in containers connected by VDE switches. This works with qemu nodes, but not process nodes. Topologies that include both openvz nodes and qemu nodes that shape traffic should use this. See the discussion below.
Do traffic shaping in VDE switches. Probably the default, but that is controlled in the site configuration. See the discussion below.
Set the default openvz disk space size. The suffixes G and M stand for gigabytes and megabytes.
Set the default openvz amount of RAM per openvz container. The suffixes G and M stand for gigabytes and megabytes. The default is 512M if not specified.
Set the default openvz template. Templates are described in the users guide.
Add a directory to be searched for openvz templates. Templates must end in tar.gz and be accessible to the user at creation and swap time. They can only be located under the /proj or /share directories.
Construct a visualization of the virtual topology and leave it in the experiment directories (default)
Ignore network constraints when partitioning nodes.
Do not construct a visualization of the virtual topology and leave it in the experiment directories
Specify the packing factor for each partitioning pass. The users guide describes this in detail
Specify the number of physical machines to use for each partitioning pass. The users guide describes this in detail
Specify the pnode types on which nodes packed in partitioning pass pass can be placed. The users guide describes this in detail
Specify the partitioning passes on which network connectivity is ignored. The users guide describes this in detail
Make sure that Qemu images mount the given users' home directories. Qemu nodes can mount at most 19 users' home directories and this ensures that the experimenters using the containers can reach their home directories.
If given, mount the experiment project's zfs partition under /zfs on both the pnodes and containers.
Print additional diagnostics and leave failed DETER experiments on the testbed
Do not remove temporary files - for debugging only

This invocation:

$ ./ --packing 25 --default-container=qemu --force-partition DeterTest faber-packem ~/experiment.xml

takes the topology in ~/experiment.xml (which must be topdl), packs it into 25 qemu containers per physical node, and creates an experiment called DeterTest/faber-packem that can be swapped in. If experiment.xml were already partitioned, it will be re-partitioned. If some nodes in that topology were assigned to openvz nodes already, those nodes will be still be in openvz containers.

The result of a successful run is a DETER experiment that can be swapped in.

More detailed examples are available in the tutorial

The command draws a picture of the topology of an experiment. This is helpful in keeping track of how virtual nodes are connected. calls this internally and stores the output in the per-experiment directory (unless --no-image is used.

A researcher may call directly to generate an image later or to generate one with the partitioning drawn.

The simplest way to call is:

/share/containers/ topology.xml output.png

The first parameter is a topdl description, for example the one in the per-experiment directory. The second parameter is the output file for the image. When drawing an experiment that has been containerized, the --experiment option is very useful.

Options include:

Draw the experiment in project/experiment, if it exists. Note that this is just DETER experiment and DETER project. Omit any sub-group.
Draw the topology in filename --attr-prefix=prefix Prefix for containers attributes. Deprecated.
Draw labeled boxes around nodes that share a physical node.
Save the image in filename
Use programname to lay out the graph. programname must take a file in graphviz's dot language. This is given as the --program option to internally. The default is fdp which works well when --partitions is given.

If neither --topo nor --experiment is given, the first positional parameter is the topdl topology to draw. If --out is not given the next positional parameter (the first if --topo nor --experiment is given) is the output file.

A common invocation looks like:

/share/containers/ --experiment SAFER/testbed-containers ~/drawing.png

Topdl Attributes For Containers

Several topdl attributes influence how an experiment is containerized. These can be added to nodes using the ns2 tb-add-node-attribute command (used throughout the tutorial) or directly to the topdl.

These are all attached to nodes/Computers:

The container that will hold this node. The full list is availible.
An identifier grouping nodes together containers that will share a physical node. Generally assigned by, but reserachers can also directly assign them. The command assigns integers, so if a researcher assigns other partition identifiers, will not overwrite them.
The flavor of linux distribution to emulate on openvz. There is a list of valid choices in the Users Guide.
Amount of disk space to allocate to an openvz container. Be sure to include the G (gigabyte) or M (megabyte) suffix or the size will be taken as disk blocks.
Amount of RAM to allocate to an openvz container. Be sure to include the G (gigabyte) or M (megabyte) suffix.
If this attribute is true, resources will be allocated for this node, but it will not be started when the topology is created.
A location to download the QEMU image for this container. The name is a legacy that will disappear. This is deprecated.

There are a few other attributes that are meaningful to more applications. Users specifying ns2 files will not need to set these directly, as the DETER ns2 interpreter does so.

On Computers:

The start command. tb-set-node-startcmd sets this.

On interfaces

The IPv4 address of this interface. Set by the ns2 commands for fixing addresses.
The IPv4 netmask. ns2 sets this.

Configuration Files

These files control the operation of the containers system.

Per-experiment Directory

When an experiment is containerized, the data necessary to create it is stored in /proj/project/exp/experiment/containers. The /proj/project/exp/experiment is created by DETER when the experiment is created, and used by experimenters for a variety of things. This directory is replicated on nodes under /var/containers/config.

There are a few files in the per-experiment directory that most experimenters can use:

If the topology was passed to as an ns file, this is a copy of that input file. Useful for seeing what the experimenter asked for, or as a basis for new experiments.
The analogue of experiment.tcl is the topology was given as topdl. The topdl input file.
A drawing of the virtual topology in png format. Generated by
The host to IP mapping that will be installed on each node as /etc/hosts. site.conf: A clone of the site configuration file that holds the global variables that the container creation will use. Values overridden on the command line invocation of will be present in this file.

The rest of this directory is primarily of interest to developers. It includes:

First version of the input topology after default container types have been added. Input to the partitioning step.
A yaml representation of the partition to virtual node mapping.
The server and channel to use for grandstand communication. Encoded in yaml.
Directory containing the assignment, including all the levels of nested hypervisors.
The contents of the per-experiment directory (except config.tgz) for distribution into the experiment.
A yaml-encoded representation of the children sub-directory
Containers that are initially not started in the experiment. maverick_url: Yaml encoding of the qemu images to be used on each node.
Yaml encoding of the openvz templates to be used on each node.
Output of the partitioning process. A copy of annotated.xml that has been decorated with the partitions.
The ns2 file used to create the DETER experiment.
The topdl file used to generate phystopo.ns.
The DETER project and experiment name under which this topology will be created. Broken out into /var/containers/pid and /var/containers/eid on virtual nodes inside the topology.
A directory containing the routing tables for each node
Yaml-encoded data about the per-network and per-node loss, delay, and capacity parameters.
A directory containing the VDE switch topology for the experiment.
Yaml-encoded extra switch configuration information. Mostly VDE switch configuration esoterica.
The final topology representation from which the physical topology is extracted. Includes the virtual topology as well. This file can be used as input to traffic_shaping.pickle: Pickled information for configuring endnode traffic shaping.
Specific parameters for configuring the delay elements in VDE switched topologies that implement traffic shaping. See below.

Site Configuration File

The site configuration file controls how all experiments are containerized across DETER. The contents are primarily of interest to developers, but researchers may occasionally find the need to specify their own. The --config parameter to does that.

The site configuration file is an attribute value pair file parsed by a python ConfigParser that sets overall container parameters. Many of these have legacy internal names.

The default site configuration is in /share/containers/site.conf on

Acceptable values (and their DETER defaults) are:

The IRC server used as a backend coordination service for grandstand. Will be replaced by MAGI. Default:
Port that third party applications can contact grandstand on. Will be replaced by MAGI. Default: 4919
Default image used by qemu containers. Default: http://scratch/benito/pangolinbz.img.bz2
Base URL of the DETER web interface on which users can see experiments. Default:
Hardware used by containers. Default: pc2133,bpc2133,MicroCloud
Host and port from which to request experiment creation. Default:
OSID to request for qemu container nodess. Default: Ubuntu1204-64-STD
Root of the directory tree holding containers software and libraries. Developers often change this. Default: /share/containers
OSID to request for openvz nodes. Default CentOS6-64-openvz
Location to load the openvz template from. Default: %(exec_root)s/images/ubuntu-10.04-x86.tar.gz
True if switched containers (see below) should do traffic shaping in the VDE switch that connects them. Default: true
A list of the containers that are networked with VDE switches. Default: qemu,process
The directory that stores openvz template files. Default: %(exec_root)s/images/ (that is the images directory in the exec_root directory defined in the site config file. This can be a comma-separated list that will be searched in order, after any template directories given on the command line.
The name of the file on experiment nodes used to log containers creation. Default is /tmp/containers.log
The program used to convert ns2 descriptions to topdl. The default is --file but any program that takes a single ns2 file as a parameter and prints the topdl to standard output is viable. On DETER installations /usr/testbed/lib/ns2ir/parse.tcl -t -x 3 -m dummy dummy dummy dummy can be used to decouple containers from needing a running fedd.
The IP address of a router needed to reach testbed infrastructure
The network on which testbed infrastructure lives that needs to be routed through default_router.

Container Notes

Different container types have some quirks. This section lists limitations of each container, as well as issues in interconnecting them.


Qemu nodes are limited to 7 experimental interfaces. They currently run only Ubuntu 12.04 32 bit operating systems.

ViewOS Processes

These have no way to log in or work as conventional machines. Process tree rooted in the startcommand is created, so a service will run with its own view of the network. It does not have an address on the control net.

Because of a bug in their internal routing, multi-homed processes do not respond correctly for requests on some interfaces. A ViewOS process does not recognize its other addresses when a packe arrives on a different interface. A picture makes this clearer:

Viewos ping diagram

Container A can ping Interface X ( of the ViewOS container successfully, but if Container A tries to ping Interface Y ( the ViewOS container will not reply (in fact it will send ARP requests on Interface Y looking for its own address).

ViewOS processes are best used as lightweight forwarders for this reason.

Physical Nodes

Physical nodes can be incorporated into experiments, but should only use modern versions of Ubuntu, to allow the container system to run their start commands correctly and to initialize their routing tables.

Interconnections: VDE switches and local networking

The various containers are interconnected using either local kernel virtual networking or VDE switches. Kernel networking is lower overhead because it does not require process context switching, but VDE switches are a more general solution.

Network behavior changes - loss, delay, rate limits - are introduced into a network of containers using one of two mechanisms: inserting elements into a VDE switch topology or end node traffic shaping. Inserting elements into the VDE switch topology allows the system to modify the behavior for all packets passing through it. Generally this means all packets to or from a host, as the container system inserts these elements in the path between the node and the switch.

This figure shows 3 containers sharing a virtual LAN (VLAN) on a VDE switch with no traffic shaping:

Unshaped traffic through a VDE switch

The blue containers connect to the switch and the switch has interconnected their VDE ports into the red shared VLAN. To add delays to tow of the nodes on that VLAN, the following VDE switch configuration would be used:

Traffic sahping using VDE

The VDE switch connects the containers with shaped traffic to the delay elements, not to the shared VLAN. The delay elements are on the VLAN and delay all traffic passing through them. The container system configures the delay elements to delay traffic symmetrically - traffic from the LAN and traffic from teh container are both delayed. The VDE tools can be configured asymmetrically as well. This is a very flexible way to interconnect containers.

That flexibility incurs a cost in overhead. Each delay element and the VDE switch is a process, do traffic passing from one delayed nodes to the other experiences 7 context switches: container -> switch, switch -> delay, delay -> switch, switch -> delay, delay -> switch, and switch -> container.

The alternative mechanism is to do the traffic shaping inside the nodes, using linux traffic shaping. In this case, traffic outbound from a container is delayed in the container for the full transit time to the next hop. The next node does the same. End-node shaping all happens in the kernel so it is relatively inexpensive at run time.

Qemu nodes can make use of either end-node shaping or VDE shaping, and use VDE shaping by default. The --end-node-shaping and --vde-switch-shaping options to forces the choice in qemu.

ViewOS processes can only use VDE shaping. Their network stack emulation is not rich enough to include traffic shaping.

Openvz nodes only use end-node traffic shaping. They have no native VDE support so interconnecting openvz containers to VDE switches would include both extra kernel crossings and extra context switches. Because a primary attraction of VDE switches is their efficiency, the containers system does not implement VDE interconnections to openvz.

Similarly embedded physical nodes use only endnode traffic shaping, as routing outgoing traffic through a virtual switch infrastructure that just connects to its physical interfaces is at best confusing.

Unfortunately, endnode traffic shaping and VDE shaping are incompatible. Because end node shaping does not impose delays on arriving traffic, it cannot delay traffic from a VDE delayed node correctly.

This is primarily of academic interest, unless a researcher wants to impose traffic shaping between containers using incompatible traffic shaping. There needs to be an unshaped link between the two kinds of traffic shaping.

Bootable Qemu Images

For qemu images to boot reliably they should not wait for a keypress at the grub command, which is distressingly common.

To insure that your image does not wait for grub do the following:

For Ubuntu 12.04 (and any system that uses grub2) edit /etc/default grub. Sample:

GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`

Just make sure the HIDDENs are not commented out and have true/0 values.

You then have to run a command on the system which generates all the new grub configurations:

$ sudo update-grub

sudo configuration

The containers software adds all users to the admin group so that group should be able to sudo without providing a password.

Last modified 8 years ago Last modified on Apr 7, 2016 8:54:29 AM

Attachments (3)

Download all attachments as: .zip