Skip to content

Containers

View Container

GET /api/containers/{id}

OAuth authorization required: project_read

Schema
  • container: Object
    • id: Integer
    • name: String
    • req_state: String<running,stopped>
    • stats: Object
      • cpu: Decimal
      • mem: Decimal
    • current_state: String<migrating,starting,stopping,working,alert,resource_usage,online,offline>
    • local_ip: String
    • public_ip: String
    • created_at: DateTime
    • updated_at: DateTime
    • ingress_rules: Array
      • ingress_rule: Object
        • id: Integer
        • port: Integer
        • port_nat: Integer
        • proto: String<http,tcp,tls,udp>
        • external_access: Boolean
        • backend_ssl: Boolean
        • tcp_proxy_opt: String<none,send-proxy,send-proxy-v2,send-proxy-v2-ssl,send-proxy-v2-ssl-cn>
        • redirect_ssl: Boolean
        • restrict_cf: Boolean | If true, only allow CloudFlare
        • tcp_lb: Boolean
        • created_at: Boolean
        • updated_at: Boolean
        • container_service_id: Integer
        • load_balancer_rule_id: Integer
        • internal_load_balancer_id: Integer
        • load_balanced_rules: Array
        • links: Object
          • domains: String (url)
    • on_latest_image: Boolean | Whether the container runs the image its tag currently points to on the node. false means a newer image was pulled and the container needs a rebuild. Checked live, giving up after a few seconds; true whenever the node can't answer, is offline or in maintenance, or the container isn't on the node. In container listings, checks stop after about 10 seconds in total, and any containers not yet checked report true.
    • node_status: Object | Status of the node running this container. See Node status.

Power Control

PUT /api/containers/{container-id}/power/{action}

OAuth authorization required: project_write

action: String<start,stop,restart,rebuild>

Responds with 202 Accepted and the event_id of the power action. This endpoint takes no callback; poll the event, or use the service-level power endpoint, which accepts one.

If the container's node is in maintenance, the action is deferred: the response is still 202 Accepted, with deferred: true, code: "node_maintenance", and the container's node_status, and the action runs on the same event once maintenance ends. A later power request for the same container replaces a waiting one. See Refused and deferred actions.

If another action is already in progress on the container, the response is 202 Accepted with deferred: false, but the event is canceled ("Action already in progress").

If the node is offline (or the container has no node), the response is 409 Conflict with errors, code: "node_offline", and node_status. This previously returned 422. Other failures return 422 Unprocessable Entity with errors.

Schema
  • event_id: Integer
  • deferred: Boolean | true if the action waits for maintenance to end.
  • code: String | node_maintenance. Only present when deferred is true.
  • node_status: Object | Only present when deferred is true. See Node status.

Container Logs

GET /api/containers/{id}/logs

OAuth authorization required: project_read

  • limit: Integer | How many lines to include?
  • period_start: Integer | Log date range (start). As an integer, time since epoch. Default: 1 day ago
  • period_end: Integer | Log date range (end). As an integer, time since epoch. Default: Now

Returns an Array of Arrays containing: Timestamp, container name, log entry

Example
[
    [
    1612904254.9995728,
    "mystifying-poincare61-104",
    "t=2021-02-09T20:57:34+0000 lvl=info msg=\\"HTTP Server Listen\\" logger=http.server address=[::]:3000 protocol=http subUrl= socket="
    ],
    [
    1612904254.991145,
    "mystifying-poincare61-104",
    "t=2021-02-09T20:57:34+0000 lvl=info msg=\\"Registering plugin\\" logger=plugins id=input"
    ],
    [
    1612904254.8895183,
    "mystifying-poincare61-104",
    "t=2021-02-09T20:57:34+0000 lvl=info msg=\\"Starting plugin search\\" logger=plugins"
    ]
]

Container Processes

View processes inside of a container

GET /api/containers/{container-id}/container_processes

OAuth authorization required: project_read

Schema Returns an Array of Objects containing:

  • UID: String
  • PID: Integer
  • PPID: Integer
  • C: Integer
  • STIME: String
  • TTY: String
  • TIME: string
  • CMD: String

Container Resource Usage

Both the time, and date/memory label and format, will be formatted to match your API user's timezone and locale.


CPU Usage

GET /api/containers/{container-id}/metrics/cpu

OAuth authorization required: project_read

Schema

  • stats: Array
Example
{
    "stats": [
        [ "2021-03-11T21:55:51.000+00:00", 0.22]
    ]
}

Memory Usage

GET /api/containers/{container-id}/metrics/memory

OAuth authorization required: project_read

Schema

  • stats: Array
Example
{
    "stats": [
        [ "2021-03-11T21:55:51.000+00:00", 9]
    ]
}