List all NAV Docker Image Tags on Docker Hub

Some time ago, I created this script because I wanted to know all the available tags on dockerhub for the “microsoft/dynamics-nav” repository on Docker.

Why? I don’t know anymore :-). But it was clear that the “tags” section on DockerHub only showed us a very small part of the available tags.

Yesterday, we were wondering why a specific version (one that we used quite some time ago from an insider version) wouldn’t download – and we wanted to have a version ‘as close as possible’ to the one we were using. Well – we need a list for that ;-).

PowerShell

You might not be surprised I used PowerShell for that – however I might as well used AL for it. It’s a simple web service-call with a JSON-response. So, it’s quite easy.

Here is the script:

$ResultingObject = @()

$result = Invoke-WebRequest -Uri "https://registry.hub.docker.com/v2/repositories/microsoft/dynamics-nav/tags/?page_size=250" 
$JsonObject = ConvertFrom-Json -InputObject $result.Content
$ResultingObject = $JsonObject.results
$ParentId = 1

while ($JsonObject.next) {
    $result = Invoke-WebRequest -Uri $JsonObject.next 
    $JsonObject = ConvertFrom-Json -InputObject $result.Content
    $ResultingObject += $JsonObject.results    
    
    $percCompleted = [Math]::Round($ResultingObject.Count / $JsonObject.count, 4) * 100
    Write-Progress -Activity "Processing tags" -PercentComplete $percCompleted -ParentId $ParentId 
}

The result is in the “ResultingObject” variable. So you can just query that JSON Array. Here are a few examples:

Display the number of tags:

$ResultingObject.Count

Display all tags:

$ResultingObject.name

All Belgian tags:

$ResultingObject | where name -like ‘*be’ | select name

Search for a certain version:

$ResultingObject | where name -like ‘*11.0.21063*’ | select name

Enjoy!

5.00 avg. rating (97% score) - 1 vote

Permanent link to this article: https://www.waldo.be/2018/08/06/list-all-nav-docker-image-tags-on-docker-hub/

3 comments

5 pings

    • Jonas on August 6, 2018 at 7:23 am
    • Reply

    Hey Waldo. Could you modify the script to use a page_size? That way, docker will get less queries 🙂 https://registry.hub.docker.com/v2/repositories/microsoft/dynamics-nav/tags/?page_size=250

      • waldo on August 6, 2018 at 8:05 am
        Author

      So much faster :-);

      Thanks so much!

    • Kriki on August 7, 2018 at 2:56 pm
    • Reply

    and use
    $result = Invoke-WebRequest -Uri “https://registry.hub.docker.com/v2/repositories/microsoft/bcsandbox/tags/?page_size=250”

    for BC!

  1. […] Bron : Waldo’s Blog Lees meer… […]

  2. […] Waldo’s Blog on Docker Image Tags […]

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.