Get all running Docker containers that have an image taken from a specific image

I have two Docker images, name them base

and derived

. As the names suggest, one is FROM

ed from the other.

Now, among other containers, I am running multiple instances derived

.

How can I get a list of all of them? In other words: How can I identify containers whose image is derived from a specific base image?

Any hints?

+3


source to share


2 answers


You can get the dockerfile from the image https://github.com/CenturyLinkLabs/dockerfile-from-image which will get this information for you. Some scripts based on this docker ps

should do what you want.



+1


source


Does this work for you?



sudo docker ps | grep base | awk '{print $1}'

      

-2


source







All Articles