Skip to content

Containers beta ​

LXC containers (product family container, scope console-containers).

Containers are being rolled out: while they are not available for the token's user, every path answers 404. A container is addressed by its id (ULID); one you cannot see answers 404.

MethodPath
GET/containersthe containers of your teams and the ones granted to you
GET/containers/{container}one container, with live status
PATCH/containers/{container}rename
DELETE/containers/{container}delete (with the name as confirmation)
POST/containers/{container}/powerstart, stop, shutdown, reboot
POST/containers/{container}/reinstallreinstall from a template
GET/containers/{container}/post-installthe latest post-install run
GET, POST/containers/{container}/backupslist, create
POST/containers/{container}/backups/{backup}/restorerestore
DELETE/containers/{container}/backups/{backup}delete
GET, POST/containers/{container}/snapshotslist, create
POST/containers/{container}/snapshots/{name}/rollbackroll back
DELETE/containers/{container}/snapshots/{name}delete

Permissions as in the Console: reading needs a view grant, power and reinstall the power level, name, backups and snapshots the manage level; deleting is for the team only.

Background operations (202) answer {"message": …} and run in the background; read the container (or the lists) again to see the result, or - as an app - wait for the product.updated webhook. An unknown backup or snapshot answers 404.

The container object ​

GET /containers/{container} returns the container with:

Field
statusrunning, stopped; null when the status cannot be read right now; provisioning while the container is being set up beta
provisioning_status betanull when ready, provisioning or failed - see Products being set up
location{id, name}
template{id, name}
primary_ipv4, primary_ipv6the container's primary addresses (with …_cidr and …_gateway)
gpu{vendor, model, vram_gb, mode, count} of a GPU container, else null (also in the list)
optionsthe LXC options of the order, {"features": […], "devices": […]}; empty lists without
post_installthe latest post-install run (see Post-install scripts)

The list (GET /containers, paginated, sorted by name) has the same fields without the live status (null) and without post_install. PATCH returns the changed container.

bash
curl https://console.anikeen.com/api/v1/containers/01JD… \
  -H "Authorization: Bearer $ANIKEEN_TOKEN" -H "Accept: application/json"

Rename ​

http
PATCH /v1/containers/{container}
{"name": "game-2"}

name is a hostname (max. 255 characters); the hostname inside the container changes with the next restart.

Delete ​

http
DELETE /v1/containers/{container}
{"name": "game-2"}
  • → 204.
  • The body's name must be the container's name (422 otherwise).
  • 409 while the deletion protection is on.
  • Deleted containers are kept for 14 days (support can restore them), then purged.
  • Deleting a GPU container gives its GPU back at once.

Power ​

http
POST /v1/containers/{container}/power
{"action": "reboot"}

action: start, stop, shutdown, reboot → 202. start and reboot answer 409 ({"message": …}, no error code) while the container is suspended for an unpaid invoice.

Reinstall ​

http
POST /v1/containers/{container}/reinstall
{"template_id": "01JC…", "ssh_key": "01JC…", "options": null, "post_install_script": "#!/bin/bash\n…"}
Field
template_idrequired, one of the active templates available for the container on its host (for a GPU container: one that supports its GPU)
ssh_keyoptional, an SSH key of the team
optionsoptional: replaces the LXC options as in the order; absent or null keeps them
post_install_scriptoptional, needs a template with supports_post_install_script - see Post-install scripts

→ 202. All data and snapshots are lost; address and hostname stay. The new root password is mailed to the team owner. 409 while suspended.

Backups ​

RequestBodyResult
GET …/backups{"data": [...]} with id, notes, size, created_at, newest first (not paginated)
POST …/backups{"notes": "before update"}202
POST …/backups/{backup}/restore202; stops the container, restores the backup over it and starts it again if it was running
DELETE …/backups/{backup}202

Snapshots ​

RequestBodyResult
GET …/snapshots{"data": [...]} with name, description, parent, created_at, newest first
POST …/snapshots{"name": "before_update", "description": "Before the update"}202
POST …/snapshots/{name}/rollback202; starts the container again if it was running
DELETE …/snapshots/{name}202

Snapshot name: a letter, then letters, digits, -, _; max. 40 characters; unique (an existing name answers 422). description: optional, max. 1000 characters. Backup notes: optional, max. 1000 characters.

What survives what ​

  • The LXC options stay through reinstall, backup restore and snapshot rollback (they are set again after restoring an older state). If they cannot be applied at that moment, the reinstall, restore or rollback fails without changing anything.
  • A GPU container keeps its GPU through reinstall, backup restore, snapshot rollback, a billing suspension and a transfer.

With the PHP SDK ​

php
$container = $console->containers()->find($id);

$container->power('reboot');
$container->snapshots()->create('before_update', 'Before the update');

See SDK containers.

Anikeen Console documentation