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_DEBUG | Adds additional debug logging, mainly for troubleshooting and development. | |
| 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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file docker_registry_client_async-0.1.13.tar.gz.
File metadata
- Download URL: docker_registry_client_async-0.1.13.tar.gz
- Upload date:
- Size: 31.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.56.2 CPython/3.8.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c91b4791af7652bdd2222c9743029f5786bb032f27d424fe819339c58c881f2f
|
|
| MD5 |
4716ace55ee5b7dac7b41c2698940b38
|
|
| BLAKE2b-256 |
6e51e807d31d2be5eb9b78ba213bcb2a2697860fecbf6de40fbdff02d7df0fb1
|
File details
Details for the file docker_registry_client_async-0.1.13-py3-none-any.whl.
File metadata
- Download URL: docker_registry_client_async-0.1.13-py3-none-any.whl
- Upload date:
- Size: 41.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.56.2 CPython/3.8.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f205468a0a33b268640909030b500c56be7d7eeae4c2c8abdc0a9fa04ae60ade
|
|
| MD5 |
bd5a352864bf186f705e786941b7d40f
|
|
| BLAKE2b-256 |
8c7ba68778e0806f6446cbae839d0ebc02909006308384a4376a2946c2f894a9
|