kwk/docker-registry-frontend

Ability to sort images by creation date

HaraldNordgren opened this issue · 9 comments

In the list of images under a repository, I want to be able to sort images based on Creation date or Tag.

I also really really want this feature.

wow! this feature was not considered in the redesign? very poor!

I strongly agree - it would be very nice if we can get this working!

This is my number 1 hatred of Docker hub and what triggered me to go find an alternative, I'd love to see this implemented!

The issue here is the same as the Kubernetes dashboard sorting issue: the API does not support sorting (in fact it doesn't return anything other than an array of strings!) https://docs.docker.com/registry/spec/api/#listing-image-tags,

return $resource('/v2/:repoUser/:repoName/tags/list', {}, {

The details (such as Created date) are then filled out in

return $resource('/v2/:repoUser/:repoName/manifests/:tagName', {}, {

So the sorting must happen after these two bits of code have run before rendering.

Unfortunately I have no idea how to navigate Angular projects! But hopefully someone more vested in Angular/JS can tackle this one!

+1

This is slow, and ugly, and probably highlights some glaring deficiencies in my understanding of bash. But it does work:

docker_images_date() {
    docker images | head -n 1
    sorted_images=$(echo $(for id in $(docker images -aq) ; do
              docker inspect -f "{{.Created}}" $id
              echo ,$id                                              
          done) | sed 's/ ,/_/g;s/ /\n/g' | sort -r | sed 's/^.*_//')
    for image in $sorted_images ; do
        docker images | grep $image
    done
}

You can put that in your .bashrc and then do:

docker_images_date | grep myreponame

And (provided you've pulled them) you'll see your images listed in reverse creation order.