containerRuntime-1.7.0
6 minute read
KOSI Plugin containerRuntime Version 1.7.0
Summary
The ContainerRuntime plugin allows you to manage container runtimes efficiently. It provides options to execute commands with or without flags and retrieve runtime status information. Supported runtimes include Docker, CRI-O, and containerd.
Plugin requirements
To use the ContainerRuntime plugin, you need the following dependencies installed:
- Docker
- CRI-O
- Contianerd
Keys
Key | Description | |
---|---|---|
command | Mandatory | Specifies the command to execute inside the container. |
containerConfig | - | Configuration file (JSON or YAML) for container creation. Example: containerConfiguration.json or containerConfiguration.yaml. |
containerName | - | Name of the container in which the command will be executed. |
destImage | - | New image name when tagging an existing image. |
execID | - | ID or name of the execution (only for containerd execution commands). |
flag | - | Options to enable specific command behaviors (e.g., -a or –all). Multiple flags can be used. |
runtime | - | Temporarily stores the runtime type when the key containerRuntime is set to status. |
srcImage | - | Source image for pull, push, or tag operations. |
sudo | - | If true, the plugin executes with sudo privileges. |
sudoPassword | - | Mandatory if sudo is set to true. |
type | - | Specifies the container runtime type. If unspecified, the plugin detects the running runtime automatically. Docker is preferred if multiple runtimes are active. |
option | Mandatory | Specifies the operation to execute. |
Supported option Values
Option | Description |
---|---|
ps | Lists all existing containers. |
images | Lists all available container images. |
run | Starts a container. |
status | Displays the runtime state (e.g., “active” if running). |
exec | Executes a command within a running container. |
tag | Renames an image (e.g., docker tag oldImage newImage). |
pull | Pulls a specified image. |
push | Pushes a specified image. (Not available in CRI-O.) |
stop | Stops a specified container. |
start | Starts a specified container. |
deleteCon | Deletes a specified container. |
ContainerD-Specific Commands
Option | Description |
---|---|
psTask | Lists all existing tasks for containerd. |
startTask | Starts a task from a given container. |
stopTask | Stops a specified task. |
deleteTask | Deletes a specified task. |
podConfig and containerConfig
These keys specify JSON or YAML configuration files required for pod creation (e.g., podConfiguration.json or podConfiguration.yaml).
Example 1 - List Running Containers (ps)
languageversion = "1.0.0";
apiversion = "kubernative/kubeops/kosi/user/v4";
name = "kosi-example-packagev3";
description = "kosi-example-package";
version = "0.1.0";
docs = "docs.tgz";
logo = "logo.png";
files =
{
input = "template.yaml";
}
containers =
{
example = ["docker.io", "nginx", "latest"];
}
install
{
containerruntime
(
type = "docker / crio / containerd";
option = "ps";
flag = "--last";
runtime = "status";
sudo = "true";
sudoPassword = "Drowssap";
);
}
Example 2 - List Images (images)
languageversion = "1.0.0";
apiversion = "kubernative/kubeops/kosi/user/v4";
name = "kosi-example-packagev3";
description = "kosi-example-package";
version = "0.1.0";
docs = "docs.tgz";
logo = "logo.png";
files =
{
input = "template.yaml";
}
containers =
{
example = ["docker.io", "nginx", "latest"];
}
install
{
containerruntime
(
type = "docker / crio / containerd";
option = "images";
flag = "--all";
runtime = "status";
sudo = "true";
sudoPassword = "Drowssap";
);
}
Example 3 - Run a Container (run)
languageversion = "1.0.0";
apiversion = "kubernative/kubeops/kosi/user/v4";
name = "kosi-example-packagev3";
description = "kosi-example-package";
version = "0.1.0";
docs = "docs.tgz";
logo = "logo.png";
files =
{
input = "template.yaml";
}
containers =
{
example = ["docker.io", "nginx", "latest"];
}
install
{
containerruntime
(
type = "docker / crio / containerd";
option = "run";
flag = "-w /path/to/dir/ -i -t";
srcImage = "registry.kubernative.net/lima:v0.8.0";
containerName = "myFirstContainer";
runtime = "status";
sudo = "true";
sudoPassword = "Drowssap";
);
}
Example 4 - Run a CRI-O Pod
languageversion = "1.0.0";
apiversion = "kubernative/kubeops/kosi/user/v4";
name = "kosi-example-packagev3";
description = "kosi-example-package";
version = "0.1.0";
docs = "docs.tgz";
logo = "logo.png";
files =
{
input = "template.yaml";
}
containers =
{
example = ["docker.io", "nginx", "latest"];
}
install
{
containerruntime
(
type = "crio";
option = "run";
containerConfig = "/root/podConfig.json / .yaml";
podConfig = "/root/podConfig.json / .yaml";
runtime = "status";
sudo = "true";
sudoPassword = "Drowssap";
);
}
Example 5 - Check Runtime Status (status)
languageversion = "1.0.0";
apiversion = "kubernative/kubeops/kosi/user/v4";
name = "kosi-example-packagev3";
description = "kosi-example-package";
version = "0.1.0";
docs = "docs.tgz";
logo = "logo.png";
files =
{
input = "template.yaml";
}
containers =
{
example = ["docker.io", "nginx", "latest"];
}
install
{
containerruntime
(
type = "docker / crio / contianerd";
option = "status";
runtime = "status";
sudo = "true";
sudoPassword = "Drowssap";
);
}
Example 6 - Execute a Command in Containerd (exec)
languageversion = "1.0.0";
apiversion = "kubernative/kubeops/kosi/user/v4";
name = "kosi-example-packagev3";
description = "kosi-example-package";
version = "0.1.0";
docs = "docs.tgz";
logo = "logo.png";
files =
{
input = "template.yaml";
}
containers =
{
example = ["docker.io", "nginx", "latest"];
}
install
{
containerruntime
(
type = "contianerd";
option = "exec";
execID = "exec1";
containerName = "registry.kubernative.net/lima:v0.8.0";
command = "mkdir /tmp/testdir";
runtime = "status";
sudo = "true";
sudoPassword = "Drowssap";
);
}
Example 7 - Execute a Command in Docker / CRI-O (exec)
languageversion = "1.0.0";
apiversion = "kubernative/kubeops/kosi/user/v4";
name = "kosi-example-packagev3";
description = "kosi-example-package";
version = "0.1.0";
docs = "docs.tgz";
logo = "logo.png";
files =
{
input = "template.yaml";
}
containers =
{
example = ["docker.io", "nginx", "latest"];
}
install
{
containerruntime
(
type = "docker / crio";
option = "exec";
containerName = "registry.kubernative.net/lima:v0.8.0";
command = "mkdir /tmp/testdir";
runtime = "status";
sudo = "true";
sudoPassword = "Drowssap";
);
}
Example 8 - Tag an Image (tag)
languageversion = "1.0.0";
apiversion = "kubernative/kubeops/kosi/user/v4";
name = "kosi-example-packagev3";
description = "kosi-example-package";
version = "0.1.0";
docs = "docs.tgz";
logo = "logo.png";
files =
{
input = "template.yaml";
}
containers =
{
example = ["docker.io", "nginx", "latest"];
}
install
{
containerruntime
(
type = "docker / containerd";
option = "tag";
srcImage = "registry.kubernative.net/lima:v0.8.0";
destImage = "yourRegistry/yourName:v0.8.0";
runtime = "status";
sudo = "true";
sudoPassword = "Drowssap";
);
}
Example 9 Start, Stop, or Delete a Container (deleteCon, start, stop)
languageversion = "1.0.0";
apiversion = "kubernative/kubeops/kosi/user/v4";
name = "kosi-example-packagev3";
description = "kosi-example-package";
version = "0.1.0";
docs = "docs.tgz";
logo = "logo.png";
files =
{
input = "template.yaml";
}
containers =
{
example = ["docker.io", "nginx", "latest"];
}
install
{
containerruntime
(
type = "docker / crio / containerd";
option = "deleteCon / start / stop";
containerName = "myFirstContainer";
runtime = "status";
sudo = "true";
sudoPassword = "Drowssap";
);
}
Example 10 - Pull or Push an Image (pull, push)
languageversion = "1.0.0";
apiversion = "kubernative/kubeops/kosi/user/v4";
name = "kosi-example-packagev3";
description = "kosi-example-package";
version = "0.1.0";
docs = "docs.tgz";
logo = "logo.png";
files =
{
input = "template.yaml";
}
containers =
{
example = ["docker.io", "nginx", "latest"];
}
install
{
containerruntime
(
type = "docker / crio / containerd";
option = "pull / push";
srcImage = "registry.kubernative.net/lima:v0.8.0";
runtime = "status";
sudo = "true";
sudoPassword = "Drowssap";
);
}
Note: CRI-O does not support the push and tag operations.
ContainerD-Specific Commands
Example 11 List Tasks (psTask)
languageversion = "1.0.0";
apiversion = "kubernative/kubeops/kosi/user/v4";
name = "kosi-example-packagev3";
description = "kosi-example-package";
version = "0.1.0";
docs = "docs.tgz";
logo = "logo.png";
files =
{
input = "template.yaml";
}
containers =
{
example = ["docker.io", "nginx", "latest"];
}
install
{
containerruntime
(
type = "containerd";
option = "psTask";
flag = "--all";
runtime = "status";
sudo = "true";
sudoPassword = "Drowssap";
);
}
Example 12 Start, Stop, or Delete a Task
languageversion = "1.0.0";
apiversion = "kubernative/kubeops/kosi/user/v4";
name = "kosi-example-packagev3";
description = "kosi-example-package";
version = "0.1.0";
docs = "docs.tgz";
logo = "logo.png";
files =
{
input = "template.yaml";
}
containers =
{
example = ["docker.io", "nginx", "latest"];
}
install
{
containerruntime
(
type = "containerd";
option = "startTask /stopTask / deleteTask";
flag = "--null-io";
containerName = "myFirstTask";
runtime = "status";
sudo = "true";
sudoPassword = "Drowssap";
);
}