<p>I think you want the <code>ancestor</code> filter :</p>

<p>From the <a href="https://docs.docker.com/engine/reference/commandline/ps/" rel="nofollow noreferrer">Docker Docs on <code>ps</code></a>:</p>

<blockquote>
  <p><code>ancestor</code> - Filters containers which share a given image as an ancestor. Expressed as <code>image-name[:&lt;tag&gt;]</code>, <code>image id</code>, or <code>image@digest</code></p>
</blockquote>

<pre><code>$docker run -d --rm redis 
c4cf36467d63c66f7d3d8271dd0f8e51ede4a627048eb5e294a2445f5b0d30ef
$ docker ps -f "ancestor=redis"
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS               NAMES
c4cf36467d63        redis               "docker-entrypoint.s…"   16 seconds ago      Up 15 seconds       6379/tcp            elated_yonath
</code></pre>

CC BY-SA 4.0
2019-08-02T09:38:02.930Z
2019-08-02T10:16:45.093Z
2019-08-02T10:16:45.093Z
Bruce Becker
<p>I am trying to figure out the solution for the above question. I tried the  commands <code>docker ps -a -f "label=redis"</code> and <code>docker ps -f "name=redis"</code>, but that didn't gave any output.</p>

<p>Any help?</p>

<docker>
How to list containers that are using redis/ubuntu image in Docker
Nagesh Nagu
# How to list containers that are using redis/ubuntu image in Docker

(Asked by: username_0 on 2019-08-02)

I am trying to figure out the solution for the above question. I tried the commands `docker ps -a -f "label=redis"` and `docker ps -f "name=redis"`, but that didn't gave any output.

Any help?

**Tags:** docker


---

## 1 answers

### Answer by username_1 on 2019-08-02. Score: 1

I think you want the ancestor filter :
From the Docker Docs on ps:

ancestor - Filters containers which share a given image as an ancestor. Expressed as image-name[:], image id, or image@digest

$docker run -d --rm redis 
c4cf36467d63c66f7d3d8271dd0f8e51ede4a627048eb5e294a2445f5b0d30ef
$ docker ps -f "ancestor=redis"
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS               NAMES
c4cf36467d63        redis               "docker-entrypoint.s…"   16 seconds ago      Up 15 seconds       6379/tcp            elated_yonath


---

