0

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?

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[:<tag>], 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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.