Skip to content

Commit 189c471

Browse files
authored
Merge pull request #31316 from shannonxtreme/dockershim-logmon-crictl
Migrate crictl to docker-cli mapping to references
2 parents 5580f5c + d01714e commit 189c471

File tree

3 files changed

+113
-79
lines changed

3 files changed

+113
-79
lines changed

content/en/docs/reference/tools/_index.md

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,17 @@ Kubernetes contains several tools to help you work with the Kubernetes system.
1212

1313
<!-- body -->
1414

15-
## Minikube
15+
## crictl
1616

17-
[`minikube`](https://minikube.sigs.k8s.io/docs/) is a tool that
18-
runs a single-node Kubernetes cluster locally on your workstation for
19-
development and testing purposes.
17+
[`crictl`](https://github.com/kubernetes-sigs/cri-tools) is a command-line
18+
interface for inspecting and debugging {{<glossary_tooltip term_id="cri" text="CRI">}}-compatible
19+
container runtimes.
2020

2121
## Dashboard
2222

2323
[`Dashboard`](/docs/tasks/access-application-cluster/web-ui-dashboard/), the web-based user interface of Kubernetes, allows you to deploy containerized applications
24-
to a Kubernetes cluster, troubleshoot them, and manage the cluster and its resources itself.
24+
to a Kubernetes cluster, troubleshoot them, and manage the cluster and its
25+
resources itself.
2526

2627
## Helm
2728
{{% thirdparty-content single="true" %}}
@@ -64,4 +65,10 @@ Kui lets you:
6465
* Type in `kubectl` commands and see them execute, even sometimes faster than `kubectl` itself
6566
* Query a {{< glossary_tooltip text="Job" term_id="job">}} and see its execution rendered
6667
as a waterfall diagram
67-
* Click through resources in your cluster using a tabbed UI
68+
* Click through resources in your cluster using a tabbed UI
69+
70+
## Minikube
71+
72+
[`minikube`](https://minikube.sigs.k8s.io/docs/) is a tool that
73+
runs a single-node Kubernetes cluster locally on your workstation for
74+
development and testing purposes.
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
---
2+
title: Mapping from dockercli to crictl
3+
content_type: reference
4+
---
5+
6+
{{% thirdparty-content %}}
7+
8+
{{<note>}}
9+
This page is deprecated and will be removed in Kubernetes 1.27.
10+
{{</note>}}
11+
12+
`crictl` is a command-line interface for {{<glossary_tooltip term_id="cri" text="CRI">}}-compatible container runtimes.
13+
You can use it to inspect and debug container runtimes and applications on a
14+
Kubernetes node. `crictl` and its source are hosted in the
15+
[cri-tools](https://github.com/kubernetes-sigs/cri-tools) repository.
16+
17+
This page provides a reference for mapping common commands for the `docker`
18+
command-line tool into the equivalent commands for `crictl`.
19+
20+
## Mapping from docker CLI to crictl
21+
22+
The exact versions for the mapping table are for `docker` CLI v1.40 and `crictl`
23+
v1.19.0. This list is not exhaustive. For example, it doesn't include
24+
experimental `docker` CLI commands.
25+
26+
{{< note >}}
27+
The output format of `crictl` is similar to `docker` CLI, despite some missing
28+
columns for some CLI. Make sure to check output for the specific command if your
29+
command output is being parsed programmatically.
30+
{{< /note >}}
31+
32+
### Retrieve debugging information
33+
34+
{{< table caption="mapping from docker cli to crictl - retrieve debugging information" >}}
35+
docker cli | crictl | Description | Unsupported Features
36+
-- | -- | -- | --
37+
`attach` | `attach` | Attach to a running container | `--detach-keys`, `--sig-proxy`
38+
`exec` | `exec` | Run a command in a running container | `--privileged`, `--user`, `--detach-keys`
39+
`images` | `images` | List images |  
40+
`info` | `info` | Display system-wide information |  
41+
`inspect` | `inspect`, `inspecti` | Return low-level information on a container, image or task |  
42+
`logs` | `logs` | Fetch the logs of a container | `--details`
43+
`ps` | `ps` | List containers |  
44+
`stats` | `stats` | Display a live stream of container(s) resource usage statistics | Column: NET/BLOCK I/O, PIDs
45+
`version` | `version` | Show the runtime (Docker, ContainerD, or others) version information |  
46+
{{< /table >}}
47+
48+
### Perform Changes
49+
50+
{{< table caption="mapping from docker cli to crictl - perform changes" >}}
51+
docker cli | crictl | Description | Unsupported Features
52+
-- | -- | -- | --
53+
`create` | `create` | Create a new container |  
54+
`kill` | `stop` (timeout = 0) | Kill one or more running container | `--signal`
55+
`pull` | `pull` | Pull an image or a repository from a registry | `--all-tags`, `--disable-content-trust`
56+
`rm` | `rm` | Remove one or more containers |  
57+
`rmi` | `rmi` | Remove one or more images |  
58+
`run` | `run` | Run a command in a new container |  
59+
`start` | `start` | Start one or more stopped containers | `--detach-keys`
60+
`stop` | `stop` | Stop one or more running containers |  
61+
`update` | `update` | Update configuration of one or more containers | `--restart`, `--blkio-weight` and some other resource limit not supported by CRI.
62+
{{< /table >}}
63+
64+
### Supported only in crictl
65+
66+
{{< table caption="mapping from docker cli to crictl - supported only in crictl" >}}
67+
crictl | Description
68+
-- | --
69+
`imagefsinfo` | Return image filesystem info
70+
`inspectp` | Display the status of one or more pods
71+
`port-forward` | Forward local port to a pod
72+
`pods` | List pods
73+
`runp` | Run a new pod
74+
`rmp` | Remove one or more pods
75+
`stopp` | Stop one or more running pods
76+
{{< /table >}}

content/en/docs/tasks/debug-application-cluster/crictl.md

Lines changed: 24 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,11 @@ You can use it to inspect and debug container runtimes and applications on a
1717
Kubernetes node. `crictl` and its source are hosted in the
1818
[cri-tools](https://github.com/kubernetes-sigs/cri-tools) repository.
1919

20-
21-
2220
## {{% heading "prerequisites" %}}
2321

2422

2523
`crictl` requires a Linux operating system with a CRI runtime.
2624

27-
28-
2925
<!-- steps -->
3026

3127
## Installing crictl
@@ -41,27 +37,37 @@ of Kubernetes. Extract it and move it to a location on your system path, such as
4137
The `crictl` command has several subcommands and runtime flags. Use
4238
`crictl help` or `crictl <subcommand> help` for more details.
4339

44-
`crictl` connects to `unix:///var/run/dockershim.sock` by default. For other
45-
runtimes, you can set the endpoint in multiple different ways:
40+
You can set the endpoint for `crictl` by doing one of the following:
41+
42+
* Set the `--runtime-endpoint` and `--image-endpoint` flags.
43+
* Set the `CONTAINER_RUNTIME_ENDPOINT` and `IMAGE_SERVICE_ENDPOINT` environment
44+
variables.
45+
* Set the endpoint in the configuration file `/etc/crictl.yaml`. To specify a
46+
different file, use the `--config=PATH_TO_FILE` flag when you run `crictl`.
4647

47-
- By setting flags `--runtime-endpoint` and `--image-endpoint`
48-
- By setting environment variables `CONTAINER_RUNTIME_ENDPOINT` and `IMAGE_SERVICE_ENDPOINT`
49-
- By setting the endpoint in the config file `--config=/etc/crictl.yaml`
48+
{{<note>}}
49+
If you don't set an endpoint, `crictl` attempts to connect to a list of known
50+
endpoints, which might result in an impact to performance.
51+
{{</note>}}
5052

5153
You can also specify timeout values when connecting to the server and enable or
5254
disable debugging, by specifying `timeout` or `debug` values in the configuration
5355
file or using the `--timeout` and `--debug` command-line flags.
5456

55-
To view or edit the current configuration, view or edit the contents of `/etc/crictl.yaml`.
57+
To view or edit the current configuration, view or edit the contents of
58+
`/etc/crictl.yaml`. For example, the configuration when using the `containerd`
59+
container runtime would be similar to this:
5660

57-
```shell
58-
cat /etc/crictl.yaml
59-
runtime-endpoint: unix:///var/run/dockershim.sock
60-
image-endpoint: unix:///var/run/dockershim.sock
61+
```
62+
runtime-endpoint: unix:///var/run/containerd/containerd.sock
63+
image-endpoint: unix:///var/run/containerd/containerd.sock
6164
timeout: 10
6265
debug: true
6366
```
6467

68+
To learn more about `crictl`, refer to the [`crictl`
69+
documentation](https://github.com/kubernetes-sigs/cri-tools/blob/master/docs/crictl.md).
70+
6571
## Example crictl commands
6672

6773
The following examples show some `crictl` commands and example output.
@@ -348,64 +354,9 @@ CONTAINER ID IMAGE CREATED STATE
348354
3e025dd50a72d busybox About a minute ago Running busybox 0
349355
```
350356

357+
## {{% heading "whatsnext" %}}
351358

359+
* [Learn more about `crictl`](https://github.com/kubernetes-sigs/cri-tools).
360+
* [Map `docker` CLI commands to `crictl`](/reference/tools/map-crictl-dockercli/).
352361

353-
354-
<!-- discussion -->
355-
356-
See [kubernetes-sigs/cri-tools](https://github.com/kubernetes-sigs/cri-tools)
357-
for more information.
358-
359-
## Mapping from docker cli to crictl
360-
361-
The exact versions for below mapping table are for docker cli v1.40 and crictl v1.19.0. Please note that the list is not exhaustive. For example, it doesn't include experimental commands of docker cli.
362-
363-
{{< note >}}
364-
The output format of CRICTL is similar to Docker CLI, despite some missing columns for some CLI. Make sure to check output for the specific command if your script output parsing.
365-
{{< /note >}}
366-
367-
### Retrieve Debugging Information
368-
369-
{{< table caption="mapping from docker cli to crictl - retrieve debugging information" >}}
370-
docker cli | crictl | Description | Unsupported Features
371-
-- | -- | -- | --
372-
`attach` | `attach` | Attach to a running container | `--detach-keys`, `--sig-proxy`
373-
`exec` | `exec` | Run a command in a running container | `--privileged`, `--user`, `--detach-keys`
374-
`images` | `images` | List images |  
375-
`info` | `info` | Display system-wide information |  
376-
`inspect` | `inspect`, `inspecti` | Return low-level information on a container, image or task |  
377-
`logs` | `logs` | Fetch the logs of a container | `--details`
378-
`ps` | `ps` | List containers |  
379-
`stats` | `stats` | Display a live stream of container(s) resource usage statistics | Column: NET/BLOCK I/O, PIDs
380-
`version` | `version` | Show the runtime (Docker, ContainerD, or others) version information |  
381-
{{< /table >}}
382-
383-
### Perform Changes
384-
385-
{{< table caption="mapping from docker cli to crictl - perform changes" >}}
386-
docker cli | crictl | Description | Unsupported Features
387-
-- | -- | -- | --
388-
`create` | `create` | Create a new container |  
389-
`kill` | `stop` (timeout = 0) | Kill one or more running container | `--signal`
390-
`pull` | `pull` | Pull an image or a repository from a registry | `--all-tags`, `--disable-content-trust`
391-
`rm` | `rm` | Remove one or more containers |  
392-
`rmi` | `rmi` | Remove one or more images |  
393-
`run` | `run` | Run a command in a new container |  
394-
`start` | `start` | Start one or more stopped containers | `--detach-keys`
395-
`stop` | `stop` | Stop one or more running containers |  
396-
`update` | `update` | Update configuration of one or more containers | `--restart`, `--blkio-weight` and some other resource limit not supported by CRI.
397-
{{< /table >}}
398-
399-
### Supported only in crictl
400-
401-
{{< table caption="mapping from docker cli to crictl - supported only in crictl" >}}
402-
crictl | Description
403-
-- | --
404-
`imagefsinfo` | Return image filesystem info
405-
`inspectp` | Display the status of one or more pods
406-
`port-forward` | Forward local port to a pod
407-
`pods` | List pods
408-
`runp` | Run a new pod
409-
`rmp` | Remove one or more pods
410-
`stopp` | Stop one or more running pods
411-
{{< /table >}}
362+
<!-- discussion -->

0 commit comments

Comments
 (0)