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!
3 comments
5 pings
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
Author
So much faster :-);
Thanks so much!
and use
$result = Invoke-WebRequest -Uri “https://registry.hub.docker.com/v2/repositories/microsoft/bcsandbox/tags/?page_size=250”
for BC!
[…] Bron : Waldo’s Blog Lees meer… […]
[…] http://www.waldo.be/2018/08/06/list-all-nav-docker-image-tags-on-docker-hub/ […]
[…] It’s slightly more complex to get to all images. I once wrote a script for it, and blogged about it. So, more info here: http://www.waldo.be/2018/08/06/list-all-nav-docker-image-tags-on-docker-hub/ […]
[…] Waldo’s Blog on Docker Image Tags […]
[…] Waldo’s Blog on Docker Image Tags […]