dockerdocker-imagedocker-tag

How can I see all docker Image tags?


I am pretty new to docker and I started playing around with it.

I downloaded the latest mongo docker image: docker pull mongo Then I view the image I downloaded (docker images) but the only information i have regarding the version of mongo is the tag which is just 'latest'

I found that I can use the docker inspect command to determine the version, which did prove helpful, but it is also very inconvenient.

since I read that each Image can have multiple tags, I am assuming the mongo image I downloaded has another tag with the version number.

How can I view all tags of an image I downloaded?


Solution

  • You can use registry api to do it, reference to this & this.

    For your case, you can just use next command:

    wget -q https://registry.hub.docker.com/v1/repositories/mongo/tags -O -  | sed -e 's/[][]//g' -e 's/"//g' -e 's/ //g' | tr '}' '\n'  | awk -F: '{print $3}'
    

    Change the mongo to others if you need tags of other images.