containerd-2.2.0
Required license:
KOSI Enterprise
5 minute read
KOSI Plugin containerd Version 2.2.0
Summary
The containerd plugin allows you to manage your container runtime efficiently. It provides options to execute commands with or without flags and enables gathering information about the current container runtime status.
Keys
| Key | Description | |
|---|---|---|
| option | Mandatory | Specifies the operation to execute (See Available Operations below). |
| command | Mandatory only for the exec operation. |
The command you want to execute inside the container. |
| containerName | - | The name of the container or the temporary name of a created cluster.*1 |
| destImage | - | The new image name for tagging srcImage. |
| execID | - | The ID or name of your execution.*2 |
| flag | - | Stores information on enabled options. Examples include -a or –all for listing all containers, or -n or –last for the last container in the list. Multiple flags can be appended. |
| sudo | - | Can be true or false. If true, the plugin executes with sudo privileges. |
| sudoPassword | - | The password for executing the command with sudo privileges. |
| srcImage | - | The image you want to pull, push, run, or tag. |
| Available Operations: |
ps- Lists all existing containers.psTask- Lists all running tasks.images- Lists all existing images.run- Starts a container (RequirescontainerNameandsrcImage).status- Displays the state of the container runtime (e.g., active).exec- Executes a command inside a running container (RequirescontainerName,execID, andcommand).tag- Renames an image (RequiressrcImageanddestImage).pull- Pulls a specified image (RequiressrcImage).push- Pushes a specified image (RequiressrcImage).stopTask- Stops a given container or task (RequirescontainerName).startTask- Starts a given container or task (RequirescontainerName).deleteCon- Deletes a specified container (RequirescontainerName).deleteTask- Deletes a specified task (RequirescontainerName).
*1: Note: For containerd, containers do not have names, only IDs. When using startTask, stopTask, or deleteTask, containerName is treated as the task name.
*2: Note: Only required for execution commands with containerd.
Example 1 - List Running Containers (ps)
languageversion = "1.0.0";
apiversion = "kubernative/kubeops/sina/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
{
containerd
(
option = "ps";
flag = "--last";
sudo = "true";
sudoPassword = "Drowssap";
);
}
Example 2 - List All Images
languageversion = "1.0.0";
apiversion = "kubernative/kubeops/sina/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
{
containerd
(
option = "images";
flag = "--all";
sudo = "true";
sudoPassword = "Drowssap";
);
}
Example 3 - Run a Container
languageversion = "1.0.0";
apiversion = "kubernative/kubeops/sina/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
{
containerd
(
option = "run";
flag = "-w /path/to/dir/ -i -t";
srcImage = "registry.kubernative.net/lima:v0.8.0";
containerName = "myFirstContainer";
sudo = "true";
sudoPassword = "Drowssap";
);
}
Example 4 - Check Container Runtime Status
languageversion = "1.0.0";
apiversion = "kubernative/kubeops/sina/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
{
containerd
(
option = "status";
sudo = "true";
sudoPassword = "Drowssap";
);
}
Example 5 - Execute a Command in a Running Container
languageversion = "1.0.0";
apiversion = "kubernative/kubeops/sina/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
{
containerd
(
option = "exec";
execID = "exec1";
containerName = "registry.kubernative.net/lima:v0.8.0";
command = "mkdir /tmp/testdir";
sudo = "true";
sudoPassword = "Drowssap";
);
}
Example 6 - Tag an Image
languageversion = "1.0.0";
apiversion = "kubernative/kubeops/sina/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
{
containerd
(
option = "tag";
srcImage = "registry.kubernative.net/lima:v0.8.0";
destImage = "yourRegistry/yourName:v0.8.0";
sudo = "true";
sudoPassword = "Drowssap";
);
}
Example 7 - Pull an Image
languageversion = "1.0.0";
apiversion = "kubernative/kubeops/sina/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
{
containerd
(
option = "pull";
srcImage = "registry.kubernative.net/lima:v0.8.0";
sudo = "true";
sudoPassword = "Drowssap";
);
}
Example 8 - Delete a Container
languageversion = "1.0.0";
apiversion = "kubernative/kubeops/sina/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
{
containerd
(
option = "deleteCon";
containerName = "myFirstContainer";
sudo = "true";
sudoPassword = "Drowssap";
);
}
Example 9 - List Running Tasks (psTask)
languageversion = "1.0.0";
apiversion = "kubernative/kubeops/sina/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
{
containerd
(
option = "psTask";
sudo = "true";
sudoPassword = "Drowssap";
);
}
Example 10 - Manage Tasks (stopTask)
languageversion = "1.0.0";
apiversion = "kubernative/kubeops/sina/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
{
containerd
(
option = "stopTask";
containerName = "task1";
sudo = "true";
sudoPassword = "Drowssap";
);
}
Notes
- Ensure that all required parameters are provided for each operation.
- Using
sudo="true"requiressudoPasswordto be set. - The
containerNamefor containerd may refer to a container ID or task name, depending on the operation.