<type>documentation</type>
<domain>plugins</domain>
<id>container</id>
<title>Container Plugins</title>
<date>$Date$</date>
<version>$Revision$</version>
<product>pro+</product>

Container plugins can be used to add support for a new type of container system
to Wing Pro's support for containers.  Wing Pro comes with support for Docker
and LXC, which are implemented in ``plugins/container`` in the
Wing installation directory.  Other container systems may be supported by
adding a similar support for each container system.

**Requirements**

In order to work with Wing, container systems must satisfy the following
requirements:

(1) The container system must allow starting a container and running a specifed command 
    within the container instance
(2) The container system must support running additional commands in an already-running
    container instance, using a specified starting directory and environment.  This must
    be achievable by running a command line on the host system.
(3) The container system must be able to map or copy files on the host system into 
    the container (including a mapping specified by Wing Pro)
(4) The container must be able to connect to the host system via TCP/IP
(5) To fully implement a plugin, the container system must be able to map TCP ports
    from the host system to the container.  However, this is optional and only needed
    for some types of development.

**API**

Container plugins need to implement the following two classes:

**CContainerInstance** represents a running instance of a container.  Wing creates an instance
of this class to manage all the tasks it needs to run on the container, including (a) those used
to inspect the Python installation and Python code found only on the container, (b) processes
started to debug or execute code, (c) processes started for running unit tests, (d) commands
run from the ``OS Commands`` tool, and (d) other processes for code reformatting and inspection.

**ContainerSupport** provides some top-level meta data and control for the supported container
system, including enumerating and shutting down all running containers.

The details of the API are documented in the file ``src/plugins/container/api.py`` in the
Wing installation directory.  Reference implementations for Docker and XLC are provided in 
``plugins/container``.

