An AIOHTTP based Python REST client for the Docker Registry.
Project description
docker-registry-client-async
Overview
An AIOHTTP based Python REST client for the Docker Registry.
Getting Started
import asyncio
import json
from docker_registry_client_async import DockerRegistryClientAsync, FormattedSHA256, ImageName, Manifest
async def get_config(drca: DockerRegistryClientAsync, image_name: ImageName, manifest: Manifest) -> bytes:
config_digest = FormattedSHA256.parse(manifest.get_json()["config"]["digest"])
result = await drca.get_blob(image_name, config_digest)
return json.loads(result["blob"].decode("utf-8"))
async def get_manifest(drca: DockerRegistryClientAsync, image_name: ImageName) -> Manifest:
result = await drca.get_manifest(image_name)
return result["manifest"]
async def main():
image_name = ImageName.parse("busybox:1.30.1")
async with DockerRegistryClientAsync() as drca:
manifest = await get_manifest(drca, image_name)
config = await get_config(drca, image_name, manifest)
print(config)
if __name__ == "__main__":
loop = asyncio.get_event_loop()
loop.run_until_complete(main())
Compatibility
- Tested with python 3.8
Installation
From pypi.org
$ pip install docker_registry_client_async
From source code
$ git clone https://github.com/crashvb/docker-registry-client-async
$ cd docker-registry-client-async
$ virtualenv env
$ source env/bin/activate
$ python -m pip install --editable .[dev]
Environment Variables
Variable | Default Value | Description |
---|---|---|
DRCA_CACERTS | The path to the certificate trust store. | |
DRCA_CHUNK_SIZE | 2097152 | The chunk size to use then replicating content. |
DRCA_CREDENTIALS_STORE | ~/.docker/config.json | The credentials store from which to retrieve registry credentials. |
DRCA_DEFAULT_REGISTRY | index.docker.io | The default registry index to use when resolving image names. |
DRCA_DEFAULT_NAMESPACE | library | The default registry namespace to use when resolving image names. |
DRCA_DEFAULT_TAG | latest | The default image tag to use when resolving image names. |
DRCA_PROTOCOL | https | The default transport protocol to when communicating with a registry. |
DRCA_TOKEN_BASED_ENDPOINTS | index.docker.io,quay.io,registry.redhat.io | Endpoints for which to retrieve authentication tokens. |
Development
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for docker_registry_client_async-0.1.8.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | e9f90373d319b4e24efe714870ed16ff1b3cc19608a7a3be2b74158566e2faa6 |
|
MD5 | b28f062fb29a1a6888ba30e317c91c17 |
|
BLAKE2b-256 | e254b8b46cf07eebb7fa886e5d066b9fa634fcae413006f5dbc42ac5b61d1373 |
Close
Hashes for docker_registry_client_async-0.1.8-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 79a6f52a764e324ebc7d2d55df45ff4cab75080ef1f26d6e1ceffb407035546e |
|
MD5 | f614b00ed42acb98f080af8981a7d1ef |
|
BLAKE2b-256 | d83bb22ea4d4bfc3e76574eb06f367df233308597faa40fb11e36b463a75f2bc |