containerd-1.7.0
5 minute read
KOSI Plugin containerd Version 1.7.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 | |
---|---|---|
command | Mandatory | 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, or tag. |
option | Mandatory | Specifies the operation to execute (e.g., run, ps, images, exec). |
Available Operations:
- ps - Lists all existing containers.
- images - Lists all existing images.
- run - Starts a container.
- status - Displays the state of the container runtime (e.g., active).
- exec - Executes a command inside a running container.
- tag - Renames an image (e.g., docker tag
). - pull - Pulls a specified image.
- push - Pushes a specified image.
- stop - Stops a given container.
- start - Starts a given container.
- deleteCon - Deletes a specified container.
*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/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
{
containerd
(
option = "ps";
flag = "--last";
sudo = "true";
sudoPassword = "Drowssap";
);
}
Example 2 - List All 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
{
containerd
(
option = "images";
flag = "--all";
sudo = "true";
sudoPassword = "Drowssap";
);
}
Example 3 - Run a Container
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
{
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 - Check Container Runtime 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
{
containerd
(
option = "status";
sudo = "true";
sudoPassword = "Drowssap";
);
}
Example 5 - Execute a Command in a Running Container
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
{
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/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
{
containerd
(
option = "tag";
srcImage = "registry.kubernative.net/lima:v0.8.0";
destImage = "yourRegistry/yourName:v0.8.0";
sudo = "true";
sudoPassword = "Drowssap";
);
}
Example 7 - Pull or Push an Image
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
{
containerd
(
option = "pull/push";
srcImage = "registry.kubernative.net/lima:v0.8.0";
sudo = "true";
sudoPassword = "Drowssap";
);
}
Example 8 - Delete a Container
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
{
containerd
(
option = "deleteCon";
containerName = "myFirstContainer";
sudo = "true";
sudoPassword = "Drowssap";
);
}
Example 9 List Running 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
{
containerd
(
type = "containerd";
option = "psTask";
sudo = "true";
sudoPassword = "Drowssap";
);
}
Example 10 Manage Tasks (stopTask / startTask / deleteTask)
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
{
containerd
(
option = "stopTask / startTask / seleteTask";
containerName = "task1";
sudo = "true";
sudoPassword = "Drowssap";
);
}
Notes
- Ensure that all required parameters are provided for each operation.
- Using sudo=true requires sudoPassword to be set.
- The containerName for containerd may refer to a container ID or task name, depending on the operation.