Save docmachine image in local cache #2

Open
opened 2023-04-01 14:33:25 +00:00 by glenux · 1 comment
Owner

There is no way to avoid having the image being pruned, and image gets downloaded over and over again.

To avoid unnecessary pull, we should follow the strategy below:

if docmachine image does not exists in local registry
  if docmachine image cache exists
    load docmachine from cache
  else
    pull the docmachine image from remote registry
    save the downloaded image in cache
  endif
endif
run docmachine

Ex: ~/.cache/docmachine/docmachine.TAG.tar.bz2

There is no way to avoid having the image being pruned, and image gets downloaded over and over again. To avoid unnecessary pull, we should follow the strategy below: ``` if docmachine image does not exists in local registry if docmachine image cache exists load docmachine from cache else pull the docmachine image from remote registry save the downloaded image in cache endif endif run docmachine ``` Ex: `~/.cache/docmachine/docmachine.TAG.tar.bz2`
glenux added this to the By Status project 2023-10-18 21:03:34 +00:00
Author
Owner

Contexte/etat actuel dans le code (HEAD 8da1820):

  • La logique de cache cote docmachine build est dans src/build/run.cr#_pull_image.
  • Le cache est un fichier unique ~/.cache/docmachine/image.tar (ou $XDG_CACHE_HOME/docmachine/image.tar).
  • En pratique le cache n'est jamais utilise car enable_cache est desactive par defaut et non exposé dans la CLI (voir issue #21).

Pistes complementaires (non couvertes ici):

  • cacher par image/tag (eviter un seul image.tar partage), + metadata/digest pour verifier que l'archive correspond bien a l'image demandee.
  • ajouter un mode offline / docker run --pull=never pour garantir qu'un run ne telecharge jamais si on veut forcer le cache.

Je propose d'ouvrir des tickets dedies pour ces points (sauf si on prefere enrichir celui-ci).

Contexte/etat actuel dans le code (HEAD 8da1820): - La logique de cache cote `docmachine build` est dans `src/build/run.cr#_pull_image`. - Le cache est un fichier unique `~/.cache/docmachine/image.tar` (ou `$XDG_CACHE_HOME/docmachine/image.tar`). - En pratique le cache n'est jamais utilise car `enable_cache` est desactive par defaut et non exposé dans la CLI (voir issue #21). Pistes complementaires (non couvertes ici): - cacher par image/tag (eviter un seul `image.tar` partage), + metadata/digest pour verifier que l'archive correspond bien a l'image demandee. - ajouter un mode offline / `docker run --pull=never` pour garantir qu'un run ne telecharge jamais si on veut forcer le cache. Je propose d'ouvrir des tickets dedies pour ces points (sauf si on prefere enrichir celui-ci).
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
glenux/docmachine-cli#2
No description provided.