dockerc module

class dockerc.DockerComposeCompute(config)

Bases: tycho.compute.Compute

delete(name, namespace='default')

Delete the running process and persistent artifacts.

start(system, namespace='default')

Given a system definition, start a distributed system.

In docker port mapping pairs of the form <host_port>:<container_port>, we ignore the host port. Tycho is designed to start many instances of an application and dynamic port allocation is assumed.

Volume mounts of the form <host_path>:<container_path> will make a platform specific mapping of host_path. The general request format is:

{
   "name"   : <name of the system>,
   "env"    : <text of .env environment variables>,
   "system" : <JSON of a docker-compose yaml>
}

Responses contain status, message, and result elements.:

{
  "status": "success",
  "result": {
    "name": "nginx-7703f9cbf8f34caf8bc64e84384b7f1f",
    "sid": "7703f9cbf8f34caf8bc64e84384b7f1f",
    "containers": {
      "nginx": {
        "port": 30306
      }
    }
  },
  "message": "Started system nginx-7703f9cbf8f34caf8bc64e84384b7f1f"
}
Parameters
  • system – docker-compose formatted specification of a distributed system.

  • namespace (string) – Namespace. May not be supported by underlying compute fabric.

Returns

Returns a JSON object including status, message, and result. Result is a dictionary containing details of the creatd object including name, system id (sid), and port mappings for each exposed service.

status(name, namespace='default')

Report status of running systems.

class dockerc.DockerComposeThread(system, port, configured, app_root)

Bases: threading.Thread

Run Docker-Compose in a thread and communicate via subprocess.

run()

Execute the system.