Chaitanya Bapat
Chaitanya Bapat

Reputation: 4029

List last N docker images

I have 50+ docker images existing locally. It's tough to manage them. Hence, I only want to list last 5 images created i.e. modify the docker images command to be able to filter only latest 5 created images.

Upvotes: 0

Views: 686

Answers (2)

Ashok
Ashok

Reputation: 3611

Can use this command:

docker images --format '{{.ID}} | {{.Repository}} | {{.Tag}} | {{.CreatedSince}} | {{.CreatedAt}} | {{.Size}}' | tail -5

.ID            -- ImageID
.Repository    -- Image repository
.CreatedSince  -- Lapsed time since the image was created
.Size          -- Image Size
.CreatedAt     -- Time when the image was created

Upvotes: 0

Thanh Nguyen Van
Thanh Nguyen Van

Reputation: 11822

Using this command:

docker images | tail -5 

Upvotes: 1

Related Questions