Skip to content

Process Containers

Version: 1.0.0

Status: ⚫⚪⚪

Containers interface for Thunder framework.

(Defined by Containers.json)

Table of Contents

Introduction

Scope

This document describes purpose and functionality of the Containers interface (version 1.0.0). It includes detailed specification about its methods and properties provided.

Case Sensitivity

All identifiers of the interfaces described in this document are case-sensitive. Thus, unless stated otherwise, all keywords, entities, properties, relations and actions should be treated as such.

Acronyms, Abbreviations and Terms

The table below provides and overview of acronyms used in this document and their definitions.

Acronym Description
API Application Programming Interface
HTTP Hypertext Transfer Protocol
JSON JavaScript Object Notation; a data interchange format
JSON-RPC A remote procedure call protocol encoded in JSON

The table below provides and overview of terms and abbreviations used in this document and their definitions.

Term Description
callsign The name given to an instance of a plugin. One plugin can be instantiated multiple times, but each instance the instance name, callsign, must be unique.

References

Ref ID Description
HTTP HTTP specification
JSON-RPC JSON-RPC 2.0 specification
JSON JSON specification
Thunder Thunder API Reference

Description

Process Containers JSON-RPC API.

Methods

The following methods are provided by the Containers interface:

Containers interface methods:

Method Description
start Starts a new container
stop Stops a container

start method

Starts a new container.

Parameters

Name Type M/O Description
params object mandatory ...
params?.name string optional Name of container
params?.command string optional Command that will be started in the container
params?.parameters array optional List of parameters supplied to command
params?.parameters[#] string mandatory ...

Result

Name Type M/O Description
result null mandatory Always null (default: None)

Errors

Message Description
ERROR_UNAVAILABLE Container not found
ERROR_GENERAL Failed to start container

Example

Request

{
  "jsonrpc": "2.0",
  "id": 42,
  "method": "<callsign>.1.start",
  "params": {
    "name": "ContainerName",
    "command": "lsof",
    "parameters": [
      "-i"
    ]
  }
}

Response

{
  "jsonrpc": "2.0",
  "id": 42,
  "result": null
}

stop method

Stops a container.

Parameters

Name Type M/O Description
params object mandatory ...
params.name string mandatory Name of container

Result

Name Type M/O Description
result null mandatory Always null (default: None)

Errors

Message Description
ERROR_UNAVAILABLE Container not found

Example

Request

{
  "jsonrpc": "2.0",
  "id": 42,
  "method": "<callsign>.1.stop",
  "params": {
    "name": "ContainerName"
  }
}

Response

{
  "jsonrpc": "2.0",
  "id": 42,
  "result": null
}

Properties

The following properties are provided by the Containers interface:

Containers interface properties:

Property R/W Description
containers read-only List of active containers
networks read-only List of network interfaces of the container
memory read-only Memory taken by container
cpu read-only CPU time

containers property

Provides access to the list of active containers.

This property is read-only.

Value

Name Type M/O Description
(property) array mandatory List of names of all containers
(property)[#] string mandatory ...

Example

Get Request

{
  "jsonrpc": "2.0",
  "id": 42,
  "method": "<callsign>.1.containers"
}

Get Response

{
  "jsonrpc": "2.0",
  "id": 42,
  "result": [
    "ContainerName"
  ]
}

networks property

Provides access to the list of network interfaces of the container.

This property is read-only.

The name parameter shall be passed as the index to the property, i.e. networks@<name>.

Index

Name Type M/O Description
name string mandatory ...

Value

Name Type M/O Description
(property) array mandatory List of all network interfaces related to the container
(property)[#] object mandatory Returns networks associated with the container
(property)[#]?.interface string optional Interface name
(property)[#]?.ips array optional List of ip addresses
(property)[#]?.ips[#] string mandatory IP address

Errors

Message Description
ERROR_UNAVAILABLE Container not found

Example

Get Request

{
  "jsonrpc": "2.0",
  "id": 42,
  "method": "<callsign>.1.networks@ContainerName"
}

Get Response

{
  "jsonrpc": "2.0",
  "id": 42,
  "result": [
    {
      "interface": "veth3NF06K",
      "ips": [
        "192.168.0.12"
      ]
    }
  ]
}

memory property

Provides access to the memory taken by container.

This property is read-only.

The name parameter shall be passed as the index to the property, i.e. memory@<name>.

Index

Name Type M/O Description
name string mandatory ...

Value

Name Type M/O Description
(property) object mandatory Memory allocated by the container, in bytes
(property)?.allocated integer optional Memory allocated by container
(property)?.resident integer optional Resident memory of the container
(property)?.shared integer optional Shared memory in the container

Errors

Message Description
ERROR_UNAVAILABLE Container not found

Example

Get Request

{
  "jsonrpc": "2.0",
  "id": 42,
  "method": "<callsign>.1.memory@ContainerName"
}

Get Response

{
  "jsonrpc": "2.0",
  "id": 42,
  "result": {
    "allocated": 0,
    "resident": 0,
    "shared": 0
  }
}

cpu property

Provides access to the CPU time.

This property is read-only.

The name parameter shall be passed as the index to the property, i.e. cpu@<name>.

Index

Name Type M/O Description
name string mandatory ...

Value

Name Type M/O Description
(property) object mandatory CPU time spent on running the container, in nanoseconds
(property)?.total integer optional CPU-time spent on container, in nanoseconds
(property)?.cores array optional Time spent on each cpu core, in nanoseconds
(property)?.cores[#] integer mandatory ...

Errors

Message Description
ERROR_UNAVAILABLE Container not found

Example

Get Request

{
  "jsonrpc": "2.0",
  "id": 42,
  "method": "<callsign>.1.cpu@ContainerName"
}

Get Response

{
  "jsonrpc": "2.0",
  "id": 42,
  "result": {
    "total": 2871287421,
    "cores": [
      2871287421
    ]
  }
}