Append a tarball to an image in a container registry
Project description
Append layer to container registry image
This utility script appends a tarball to an existing container image available in a container registry (without having to pull existing image data).
It supports any registry that implements the OCI Distribution Spec.
Installation
Use the script as-is or install using pip:
$ pip install appendlayer
This registers the entry-point "appendlayer" which typically lets you call it directly as an executable command.
Authentication
The script reads an OAuth2 refresh token from the REFRESH_TOKEN
environment variable.
For example, for Azure Container Registry:
$ export REFRESH_TOKEN=$(az acr login -t --name <registry-name>.azurecr.io 2>/dev/null | \
jq -r .accessToken)
(The snippet above requires jq to print out the access token.)
Usage
Pipe in the layer contents using a tarball and provide the repository (or image) name and the old and new tags:
$ echo "Hello world" > test.txt
$ tar cvf - test.txt | appendlayer <host> <repository> <old-tag> <new-tag>
For Azure Container Registry (ACR) for example, the host is
typically <registry-name>.azurecr.io
.
Changes
1.0 (2022-01-29)
- Initial release.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.