<type>documentation</type>
<domain>proj</domain>
<id>container-intro</id>
<title>Working with Containers and Clusters</title>
<date>$Date: 2010-05-14 11:53:19 -0400 (Fri, 14 May 2010) $</date>
<version>$Revision: 22093 $</version>
<product>pro+</product>

Wing Pro can work with Python code that is running on containers, like those provided by
Docker, in the same way that you work with code running locally.  This works both with
individually configured containers or with clusters of containers managed by a container
orchestration system.

.. note::

  Wing currently supports containers that are hosted by Docker or LXC/LXD, and clusters
  managed by Docker Compose. Containers must be running either Linux or macOS as their OS.
  The host OS (where Wing is running) may be Windows, macOS, or Linux.

Overview
--------

There a number of ways to work with containers in Wing:

(1) An individual container may be configured from your Wing project and used as the
    ``Python Executable`` in ``Project Properties``. In this case, Wing relies on the
    container management system to build the container and then starts up a single
    instance of the container as the location to run or debug Python code, unit tests, the
    integrated Python Shell, and OS Commands.
    
(2) Multiple containers created and managed by a container orchestration system
    may be used with your Wing project, by configuring and using a cluster for the
    ``Python Executable`` in ``Project Properties``. In this model, Wing starts the whole
    cluster of containers and debugs Python code running on a selected subset of
    containers. Wing can also run code out of context of the cluster, by starting
    instances of containers without launching the whole cluster.

(3) It is also possible to manually configure remote debugging to containers, using
    Wing Pro's `remote development <ref:proj/remote-hosts>`__ capability for containers
    that can be reached via ``ssh`` or by `manually configured remote debugging
    <ref:debug/manual-remote-debugging>`__ for other cases.

How it Works
------------

When Wing is configured to work with a container or cluster, it works with files stored on
the local host when editing, analyzing and error checking code, performing revision
control operations, searching, and so forth. However, debug processes, unit tests, the
``Python Shell``, and optionally commands defined in ``OS Commands`` are all launched
inside the containers.

Wing uses the container system to map its installation and other needed files into the
container environment, in order to support inspecting container environment, debugging
code, and accessing container-only files.

Wing implements support for containers and clusters through a plugin interface. Support
for Docker, Docker Compose, and LXC is included as a reference implementation. For more
information on adding a custom container system, see `Container Plugins
<ref:plugins/container>`__ and `Cluster Plugins <ref:plugins/cluster>`__.

