Top Related Projects
Production-Grade Container Scheduling and Management
An open and reliable container runtime
:warning: This repository is deprecated and will be archived (Docker CE itself is NOT deprecated) see the https://github.com/docker/docker-ce/blob/master/README.md :warning:
CLI tool for spawning and running containers according to the OCI specification
The Moby Project - a collaborative project for the container ecosystem to assemble container-based systems
Open Container Initiative-based implementation of Kubernetes Container Runtime Interface
Quick Overview
CRI-tools is a set of tools for Kubernetes Container Runtime Interface (CRI). It includes crictl, a CLI for CRI-compatible container runtimes, and critest, a benchmarking and conformance testing tool for CRI-compatible runtimes. These tools are essential for developers and operators working with Kubernetes and container runtimes.
Pros
- Provides a standardized way to interact with different container runtimes
- Helps ensure compatibility and conformance of container runtimes with Kubernetes
- Simplifies debugging and troubleshooting of container-related issues
- Actively maintained and supported by the Kubernetes community
Cons
- Limited to CRI-compatible runtimes, may not work with non-CRI runtimes
- Learning curve for users unfamiliar with CRI concepts
- May require additional setup and configuration in some environments
Code Examples
- Listing containers using crictl:
crictl ps
- Inspecting a container:
crictl inspect <container-id>
- Pulling an image:
crictl pull nginx:latest
- Running a container:
crictl run <pod-config.json> <container-config.json>
Getting Started
To get started with CRI-tools:
- Install crictl:
VERSION="v1.26.0"
wget https://github.com/kubernetes-sigs/cri-tools/releases/download/$VERSION/crictl-$VERSION-linux-amd64.tar.gz
sudo tar zxvf crictl-$VERSION-linux-amd64.tar.gz -C /usr/local/bin
rm -f crictl-$VERSION-linux-amd64.tar.gz
- Configure crictl:
cat <<EOF | sudo tee /etc/crictl.yaml
runtime-endpoint: unix:///run/containerd/containerd.sock
image-endpoint: unix:///run/containerd/containerd.sock
timeout: 10
debug: true
EOF
- Verify installation:
crictl version
Now you can use crictl to interact with your container runtime. For more advanced usage and critest installation, refer to the project's documentation.
Competitor Comparisons
Production-Grade Container Scheduling and Management
Pros of kubernetes
- Comprehensive container orchestration platform with a wide range of features
- Large and active community, extensive documentation, and ecosystem support
- Highly scalable and suitable for complex, enterprise-level deployments
Cons of kubernetes
- Steeper learning curve and more complex setup compared to cri-tools
- Requires more resources to run and maintain
- May be overkill for simpler container management needs
Code comparison
kubernetes:
// Sample code from kubernetes/pkg/kubelet/kuberuntime/kuberuntime_container.go
func (m *kubeGenericRuntimeManager) generateContainerConfig(
container *v1.Container,
pod *v1.Pod,
restartCount int,
podIP, imageRef string,
podIPs []string,
nsTarget *kubecontainer.ContainerID,
) (*runtimeapi.ContainerConfig, func(), error) {
// ... (implementation details)
}
cri-tools:
// Sample code from cri-tools/cmd/crictl/container.go
func CreateContainer(client pb.RuntimeServiceClient, opts createOptions) error {
config, err := loadContainerConfig(opts.configPath)
if err != nil {
return err
}
// ... (implementation details)
}
The code snippets show that kubernetes deals with more complex container configurations and management, while cri-tools focuses on simpler container operations and debugging tasks.
An open and reliable container runtime
Pros of containerd
- More comprehensive container runtime with broader functionality
- Better performance and scalability for large-scale deployments
- Active development with frequent updates and improvements
Cons of containerd
- Higher complexity and steeper learning curve
- Requires more system resources compared to lightweight alternatives
Code Comparison
cri-tools:
func RunPodSandbox(runtimeService internalapi.RuntimeService, config *runtimeapi.PodSandboxConfig) (string, error) {
podID, err := runtimeService.RunPodSandbox(config, "")
if err != nil {
return "", err
}
return podID, nil
}
containerd:
func (c *criService) RunPodSandbox(ctx context.Context, r *runtime.RunPodSandboxRequest) (*runtime.RunPodSandboxResponse, error) {
config := r.GetConfig()
sandboxID := util.GenerateID()
// ... (additional implementation details)
return &runtime.RunPodSandboxResponse{PodSandboxId: sandboxID}, nil
}
Summary
containerd is a more feature-rich and performant container runtime, suitable for large-scale production environments. It offers broader functionality but comes with increased complexity. cri-tools, on the other hand, is primarily focused on testing and validation of CRI-compatible runtimes, making it simpler to use but more limited in scope. The code comparison shows that containerd's implementation is more detailed and includes additional features, while cri-tools provides a more straightforward interface for basic CRI operations.
:warning: This repository is deprecated and will be archived (Docker CE itself is NOT deprecated) see the https://github.com/docker/docker-ce/blob/master/README.md :warning:
Pros of docker-ce
- More comprehensive container management solution, including image building and orchestration
- Wider adoption and larger community support
- Extensive documentation and resources available
Cons of docker-ce
- Heavier and more resource-intensive
- Less focused on Kubernetes integration compared to cri-tools
- Slower release cycle for updates and new features
Code Comparison
cri-tools (crictl):
crictl pull nginx
crictl run nginx.yaml
crictl ps
docker-ce:
docker pull nginx
docker run -d nginx
docker ps
Both tools provide similar functionality for container management, but cri-tools is more tailored for Kubernetes environments, while docker-ce offers a broader range of features for general container operations.
cri-tools focuses on providing a debugging and validation tool for Container Runtime Interface (CRI) implementations, making it more specialized for Kubernetes ecosystems. docker-ce, on the other hand, offers a complete container platform with additional features like image building, network management, and volume control.
While docker-ce has been widely adopted and has extensive community support, cri-tools is gaining traction in Kubernetes-centric environments due to its lightweight nature and specific focus on CRI compatibility.
CLI tool for spawning and running containers according to the OCI specification
Pros of runc
- More widely adopted and used in various container runtimes
- Supports a broader range of container features and specifications
- Actively maintained by the Open Container Initiative (OCI)
Cons of runc
- Focused solely on container runtime, lacking container image and registry tools
- May require additional components for full container management
- Less integrated with Kubernetes-specific features
Code Comparison
runc:
func (r *Runc) Create(context context.Context, id, bundle string, opts *CreateOpts) error {
args := []string{"create", "--bundle", bundle}
if opts != nil {
args = append(args, opts.AdditionalArgs...)
}
cmd := r.command(context, append(args, id)...)
return runOrError(cmd)
}
cri-tools:
func (c *CriClient) CreateContainer(ctx context.Context, request *runtimeapi.CreateContainerRequest) (*runtimeapi.CreateContainerResponse, error) {
resp, err := c.RuntimeServiceClient.CreateContainer(ctx, request)
if err != nil {
return nil, err
}
return resp, nil
}
The code snippets show that runc focuses on low-level container creation, while cri-tools provides a higher-level API for container management in Kubernetes environments.
The Moby Project - a collaborative project for the container ecosystem to assemble container-based systems
Pros of moby
- Broader scope: Moby is a complete container platform, offering more comprehensive features beyond just container runtime
- Larger community: As the foundation for Docker, Moby has a vast ecosystem and extensive documentation
- Flexibility: Supports multiple container runtimes and can be used independently of Kubernetes
Cons of moby
- Complexity: More challenging to set up and maintain due to its extensive feature set
- Resource usage: Generally requires more system resources compared to lightweight CRI tools
- Less Kubernetes-specific: May not integrate as seamlessly with Kubernetes as purpose-built CRI tools
Code comparison
cri-tools:
// Example of using crictl to inspect a container
crictl inspect <container-id>
moby:
// Example of using Docker CLI (based on Moby) to inspect a container
docker inspect <container-id>
Summary
While cri-tools is specifically designed for Kubernetes Container Runtime Interface (CRI) debugging and validation, Moby offers a more comprehensive container platform. cri-tools is lightweight and Kubernetes-focused, whereas Moby provides a broader range of features but may be more complex to manage. The choice between them depends on specific use cases and integration requirements within a container ecosystem.
Open Container Initiative-based implementation of Kubernetes Container Runtime Interface
Pros of cri-o
- Full-fledged container runtime implementation, not just a set of tools
- Designed specifically for Kubernetes, offering tight integration
- Lightweight and optimized for performance in Kubernetes environments
Cons of cri-o
- More complex setup and configuration compared to cri-tools
- Limited to Kubernetes use cases, less versatile for general container management
- Steeper learning curve for users new to container runtimes
Code Comparison
cri-o example (container creation):
container, err := c.ContainerServer.CreateContainer(ctx, &containers.Container{
ID: id,
Name: name,
Image: image,
Config: config,
})
cri-tools example (container inspection):
resp, err := runtimeClient.ContainerStatus(context.Background(), &runtimeapi.ContainerStatusRequest{
ContainerId: containerId,
Verbose: verbose,
})
While cri-o provides a full runtime implementation, cri-tools focuses on debugging and validation tools for CRI-compatible runtimes. cri-o offers more comprehensive container management capabilities, whereas cri-tools provides utilities for interacting with and testing CRI implementations.
Convert
designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
cri-tools
CLI and validation tools for Kubelet Container Runtime Interface (CRI) .
What is the scope of this project?
cri-tools aims to provide a series of debugging and validation tools for Kubelet CRI, which includes:
- crictl: CLI for kubelet CRI.
- critest: validation test suites for kubelet CRI.
What is not in scope for this project?
- Building a new kubelet container runtime based on CRI.
- Managing pods/containers for CRI-compatible runtimes by end-users, e.g. pods created by crictl may be removed automatically by kubelet because of non-exist on the kube-apiserver.
Compatibility matrix: cri-tools ⬠Kubernetes
| Kubernetes Version | cri-tools Version | cri-tools branch |
|---|---|---|
| ⥠1.27.x | ⥠1.27.x | master |
| ⥠1.16.x ⤠1.26.x | ⥠1.16.x ⤠1.26.x | master |
| 1.15.X | v1.15.0 | release-1.15 |
| 1.14.X | v1.14.0 | release-1.14 |
| 1.13.X | v1.13.0 | release-1.13 |
| 1.12.X | v1.12.0 | release-1.12 |
| 1.11.X | v1.11.1 | release-1.11 |
| 1.10.X | v1.0.0-beta.2 | release-1.10 |
| 1.9.X | v1.0.0-alpha.1 | release-1.9 |
| 1.8.X | v0.2 | release-1.8 |
| 1.7.X | v0.1 | release-1.7 |
It's recommended to use the same cri-tools and Kubernetes minor version, because new features added to the Container Runtime Interface (CRI) may not be fully supported if they diverge.
cri-tools follows the Kubernetes release cycles with respect to its minor
versions (1.x.y). Patch releases (1.x.z) for Kubernetes are not in sync with
those from cri-tools, because they are scheduled for each month, whereas
cri-tools provides them only if necessary. If a Kubernetes release goes End of
Life, then the corresponding
cri-tools version can be considered in the same way.
All new minor versions of cri-tools are being created from the master branch,
whereas corresponding release-1.x branches will be created if a patch release
is planned.
See the roadmap for information about current and future milestones.
Install
Install crictl
VERSION="v1.35.0"
wget https://github.com/kubernetes-sigs/cri-tools/releases/download/$VERSION/crictl-$VERSION-linux-amd64.tar.gz
sudo tar zxvf crictl-$VERSION-linux-amd64.tar.gz -C /usr/local/bin
rm -f crictl-$VERSION-linux-amd64.tar.gz
Install critest
VERSION="v1.35.0"
wget https://github.com/kubernetes-sigs/cri-tools/releases/download/$VERSION/critest-$VERSION-linux-amd64.tar.gz
sudo tar zxvf critest-$VERSION-linux-amd64.tar.gz -C /usr/local/bin
rm -f critest-$VERSION-linux-amd64.tar.gz
Documentation
Community, discussion, contribution, and support
Learn how to engage with the Kubernetes community on the community page.
You can reach the maintainers of this project at:
- Slack: #sig-node
- Mailing List: https://groups.google.com/a/kubernetes.io/g/sig-node
Contributing
Interested in contributing? Check out the documentation.
Code of conduct
Participation in the Kubernetes community is governed by the Kubernetes Code of Conduct.
Top Related Projects
Production-Grade Container Scheduling and Management
An open and reliable container runtime
:warning: This repository is deprecated and will be archived (Docker CE itself is NOT deprecated) see the https://github.com/docker/docker-ce/blob/master/README.md :warning:
CLI tool for spawning and running containers according to the OCI specification
The Moby Project - a collaborative project for the container ecosystem to assemble container-based systems
Open Container Initiative-based implementation of Kubernetes Container Runtime Interface
Convert
designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot