Reputation: 17
Is there a way for docker to list only the most recent image made?
The documentation for docker images
implies that there is a --filter
flag but after searching I could not come up with a way to use it in this context.
Upvotes: 1
Views: 1776
Reputation: 2203
If you want most recent tag, you could use this. --format
uses Golang formatting.
docker images --format='{{.Tag}}' | head -1
Or,
docker images --format='{{.ID}}' | head -1
Upvotes: 0
Reputation: 31654
docker images
output already formatted with descending order.
So you can just use something like follows to get the most recent image:
docker images | head -2
Output like follows:
REPOSITORY TAG IMAGE ID CREATED SIZE
python 2.7 3c43a5d4034a 9 days ago 908MB
And this is the docker filter usage, seems can not make your aims.
Upvotes: 4