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/" 
$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!

Comment List
Anonymous
Related
Recommended