Date tags on Docker Hub


#1

Hi there,

I was pushing some old code to Resin with a date tag in the base image (20170201). But this image isn’t available anymore, understandable since it is this old.

Now, if I look on Docker hub now (resin/beaglebone-black-python), I only see one date tag on the images. Does this mean, there is only one date tag image available?

And, if the date tag images aren’t available later on. What is the point of the date tags?

:thinking:

Gr.
Fokko


#2

Watching Docker Hub, I recon there is a new date tag made very 10 days?

How long does a date tag exist?


#3

hey @fokko,

the old date tags are still there but you won’t see them on dockerhub since its UI doesn’t show all existing tags. You can find all the available tag from dockerstore https://store.docker.com/community/images/resin/beaglebone-black-python/tags


#4

Hey @trong,

Thanks for the link. Will try to find some old tags that seems to be lost. (really old ones)

Thanks for update!


#5

Here’s a script to get all the tags (adapted from here):

#!/bin/bash

REPO=$1
i=0
while [ $? == 0 ]
do 
   i=$((i+1))
   curl https://registry.hub.docker.com/v2/repositories/${REPO}/tags/?page=$i 2>/dev/null | jq '."results"[]["name"]'
done

That will output all the ones found, for example:

$ ./all_tags.sh resin/beaglebone-black-python
"3-slim-20180324"
"3-slim"
"3.6-slim-20180324"
"3.6-slim"
"3.6.4-slim-20180324"
"3.6.4-slim"
"3-onbuild-20180324"
"3-onbuild"
...

#6

That generates quite some list @imrehg

How about:

from requests import get
from json import loads
from progress.bar import Bar
from prettytable import PrettyTable
import operator # -> for sorting
import textwrap

REPO = "resin/beaglebone-black-python"

tags = []
page_statuscode = 200
page_number = 1
number_of_tags = loads(get("https://registry.hub.docker.com/v2/repositories/"+REPO+"/tags/").content)['count']

bar = Bar('Downloading tags', max=number_of_tags)
while page_statuscode == 200:
   data = get("https://registry.hub.docker.com/v2/repositories/"+REPO+"/tags/?page_size=100&page="+str(page_number))
   page_statuscode = data.status_code
   if page_statuscode == 200 :
       for items in loads(data.content)['results']:
           tags.append(items['name'])
       bar.next(len(loads(data.content)['results']))
   page_number += 1
bar.finish()

groupedtags = {}
for items in tags:
    if len(items) > 8:
        date = items[-8:]
        if date.isdigit():
            base = items[:-9]
            try:
                groupedtags[base].append(items)
            except:
                groupedtags.update({base : [items]})


table = PrettyTable()
table.field_names = ['tag', 'date tag']
table.align['tag'] = 'l'
table.align['date tag'] = 'l'
for groups in sorted(groupedtags):
    taglist = ''
    for items in sorted(groupedtags[groups]):
        taglist += (items + '\n')
    table.add_row([groups,textwrap.fill(taglist,replace_whitespace=False)])
    table.add_row(['',''])
print (table)

to sort it a bit

$ python3 tags.py 
Downloading tags |################################| 6009/6009
+----------------+-------------------------+
| tag            | datetag                 |
+----------------+-------------------------+
| 2              | 2-20170311              |
|                | 2-20170316              |
|                | 2-20170318              |
|                | 2-20170322              |
|                | 2-20170323              |
|                | 2-20170325              |
|                | 2-20170329              |
|                | 2-20170330              |
|                | 2-20170401              |
|                | 2-20170403              |
|                | 2-20170405              |
|                | 2-20170406              |
|                | 2-20170412              |
|                | 2-20170413              |
|                | 2-20170429              |
|                | 2-20170506              |
|                | 2-20170513              |
|                | 2-20170517              |
|                | 2-20170518              |
|                | 2-20170520              |
|                | 2-20170524              |
|                | 2-20170525              |
|                | 2-20170527              |
|                | 2-20170531              |
|                | 2-20170601              |
|                | 2-20170603              |
|                | 2-20170607              |
|                | 2-20170610              |
|                | 2-20170717              |
|                | 2-20170718              |
|                | 2-20170719              |
|                | 2-20170720              |
|                | 2-20170722              |
|                | 2-20170723              |
|                | 2-20170724              |
|                | 2-20170727              |
|                | 2-20170729              |
|                | 2-20170802              |
|                | 2-20170803              |
|                | 2-20170805              |

#7

That is rather nice, and yey for :snake: !


#8

Go :snake:!

@nghiant2710 brings me back to the question. How long are the tags stored? Or was it some date tag startup issue.

We used to use resin beaglebone-black-python:3.6-slim-20170201 but the oldest tag is 3.6-slim-20170310. It isn’t that I want to use this image again but it always gave me the feeling we had to hurry on the date tags.

It at least has improved since then, because when I ran in this issue the tag was only 9 months old. Now the tags of 12 months old are available.


#9

we never remove any tags so don’t worry about them :slight_smile:
All images are weekly rebuilt automatically so new date tags are generated.