<p>I feel relevant and important to note that:</p>
<pre><code>ctr c ls
</code></pre>
<p>lists <strong>all</strong> containers, i.e. either stopped or running.</p>
<p>In accordance with the question title: to precisely list all <strong>running</strong> containers (in the sense of docker terminology) you need to use this command:</p>
<pre><code>ctr task list
</code></pre>
<p>or the shorthand</p>
<pre><code>ctr t ls
</code></pre>

CC BY-SA 4.0
2024-03-21T01:12:24.853Z
2024-03-21T01:12:24.853Z
adamency
<p>Try to namespace to list command</p>
<pre><code>ctr -n k8s.io containers list
</code></pre>
<p>To list available namespaces run</p>
<pre><code>ctr ns ls
</code></pre>
<p>For microk8s you have to prefix command with microk8s</p>
<p>eg: <code>microk8s ctr ns ls</code></p>

CC BY-SA 4.0
2024-03-05T08:36:44.757Z
For microk8s you have to prefix command with `microk8s ctr ...`
Jan Zahradník
CC BY-SA 4.0
2023-01-09T09:18:38.557Z
2024-05-16T21:25:57.417Z
2024-05-16T21:25:57.417Z
fsp
<p>I've switched to containerd in a k8s cluster.</p>
<p>There's 2 pods running on one node, 2 github runners.</p>
<p>I used to check on a host what containers were running with &quot;docker container ls&quot; but how to check this when containerd is used?</p>
<pre><code>sudo ctr container ls
</code></pre>
<p>comes back with nothing</p>

CC BY-SA 4.0
2022-10-26T16:11:50.653Z
Try with `crictl ps` & `crictl pods`. To be honest, I'm a bit confused between cri-o and containerd as well. Looking at kubespray especially, I would have both options, while setting "containerd" as a runtime, I would still end up using crictl listing/viewing pods, while as you suggest: ctr doesn't  show anything.
SYN
CC BY-SA 4.0
2022-10-27T05:17:15.003Z
ah yes, crictl does the job. Is that a general name so that it works with any cri?
Serve Laurijssen
CC BY-SA 4.0
2022-10-27T06:23:22.930Z
Check your `/etc/crictl.yaml`: when using containerd, your crictl configuration would just query containerd's socket file
SYN
<docker><kubernetes><containerd>
how to check running containers with containerd
Serve Laurijssen
# how to check running containers with containerd

(Asked by: username_0 on 2022-10-26)

I've switched to containerd in a k8s cluster.
There's 2 pods running on one node, 2 github runners.
I used to check on a host what containers were running with "docker container ls" but how to check this when containerd is used?
sudo ctr container ls

comes back with nothing

**Tags:** docker, kubernetes, containerd

> **Comments:**
> **username_1**: Try with `crictl ps` & `crictl pods`. To be honest, I'm a bit confused between cri-o and containerd as well. Looking at kubespray especially, I would have both options, while setting "containerd" as a runtime, I would still end up using crictl listing/viewing pods, while as you suggest: ctr doesn't  show anything.  
> **username_0**: ah yes, crictl does the job. Is that a general name so that it works with any cri?  
> **username_1**: Check your `/etc/crictl.yaml`: when using containerd, your crictl configuration would just query containerd's socket file  

---

## 2 answers

### Answer by username_3 on 2023-01-09. Score: 22 | Accepted answer

Try to namespace to list command
ctr -n k8s.io containers list

To list available namespaces run
ctr ns ls

For microk8s you have to prefix command with microk8s
eg: microk8s ctr ns ls

> **Comments:**
> **username_4**: For microk8s you have to prefix command with `microk8s ctr ...`  

---

### Answer by username_2 on 2024-03-21. Score: 2

I feel relevant and important to note that:
ctr c ls

lists all containers, i.e. either stopped or running.
In accordance with the question title: to precisely list all running containers (in the sense of docker terminology) you need to use this command:
ctr task list

or the shorthand
ctr t ls


---

