Skip to content

Sort APIImages by most recent creation date.#1396

Merged
crosbymichael merged 2 commits intomoby:masterfrom
calavera:985-ordered-api-images
Aug 19, 2013
Merged

Sort APIImages by most recent creation date.#1396
crosbymichael merged 2 commits intomoby:masterfrom
calavera:985-ordered-api-images

Conversation

@calavera
Copy link
Contributor

@calavera calavera commented Aug 3, 2013

This makes the command docker images to return the most recent created images first.

Fixes #985.

@vieux
Copy link
Contributor

vieux commented Aug 5, 2013

Hi,

I think the the sort should be in the client as I think it's a display tweak
and should be an option, like -t in ls.

@calavera
Copy link
Contributor Author

calavera commented Aug 5, 2013

I agree that this could be an option, but I don't see why it should be in the client. Moving the logic there forces everybody that writes a library to implement their own sorting.

@vieux
Copy link
Contributor

vieux commented Aug 5, 2013

For the same reason we move all -q parameters from server to client, display shouldn't be handled by the server. It should provide raw output via the api.
Imagine a web client, it might want to sort with every column, we can't implement this in the server.

At least it's my opinion, @creack @crosbymichael

@crosbymichael
Copy link
Contributor

My vote would be to keep display logic on the client.

@creack
Copy link
Contributor

creack commented Aug 7, 2013

+1 on @vieux regarding -q parameters, but I think it would be nice if the server could sort the list prior to send it.
Like this, the server still send raw data, but in a consitent way. If a client need to sort it in a different way, then it would be up to him.
At the moment, when you do 2 docker images, you will have 2 different output which is not ideal.

@calavera
Copy link
Contributor Author

calavera commented Aug 7, 2013

Yeah, that's the point of this change. I'd like to have the server to send the list of images in a consistent way. Right now you get a list according to how docker reads the graph, either it takes the heads or the map. The result is not always in the same order, which is kind of a pain to use. I think returning always a list of images sorted by creation is consistent and it makes sense in a lot of cases. It's also easy to scan and understand by the human brain.

I don't mind to move the sorting to the client, I only need to change a couple of lines, but I'd really like to get a consistent list of ordered images from the server.

@crosbymichael
Copy link
Contributor

Ok, that sounds totally reasonable to me, sry.

@vieux
Copy link
Contributor

vieux commented Aug 8, 2013

When an image is tagged 2 times, the 2 tags will have the same creation date, therefor, the sort will still be random on these. If the point if to be consistent, maybe we should add a name sort for images with the same creation data ?

ubuntu is a great exemple.

@creack
Copy link
Contributor

creack commented Aug 8, 2013

Indeed, we also need to order alphabetically

@creack
Copy link
Contributor

creack commented Aug 14, 2013

@calavera ping

@calavera
Copy link
Contributor Author

Sorry for the delay in my replays, it was a crazy couple of weeks. I agree that it should sort by creation date and name.

This establishes a strict alphabetical order for tags with the same creation date.
@vieux
Copy link
Contributor

vieux commented Aug 19, 2013

LGTM
@calavera thanks

@crosbymichael
Copy link
Contributor

LGTM

crosbymichael added a commit that referenced this pull request Aug 19, 2013
Sort APIImages by most recent creation date.
@crosbymichael crosbymichael merged commit 04c16f3 into moby:master Aug 19, 2013
@calavera calavera deleted the 985-ordered-api-images branch August 6, 2015 21:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Reorder the images command

4 participants