Skip to main content

Simple and straight forward async library for interacting with container registry API.

Project description

A python script to pull images from a Docker repository without installing Docker and its daemon.

The script creates a cache directory (~/.crpy/) to store layers already downloaded.

It was based on a simpler version called sdenel/docker-pull-push, but has since received so many changes that it does not resemble the original code anymore.

Basic usage

TODO: Fill in once the "final" version of the API is stable. For a preview of the options, here is the help command:

>>> crpy --help
usage: crpy [-h] [-k] [-p PROXY] {pull,push,login,inspect,repositories,tags,delete} ...

Package that can do basic docker command like pull and push without installing the docker virtual machine

positional arguments:
  {pull,push,login,inspect,repositories,tags,delete}
    pull                Pulls a docker image from a remove repo.
    push                Pushes a docker image from a remove repo.
    login               Logs in on a remote repo
    inspect             Inspects a docker registry metadata. It can inspect configs, manifests and layers.
    repositories        List the repositories on the registry.
    tags                List the tags on a repository.
    delete              Deletes a tag in a remote repo.

options:
  -h, --help            show this help message and exit
  -k, --insecure        Use insecure registry. Ignores the validation of the certificate (useful for
                        development registries).
  -p PROXY, --proxy PROXY
                        Proxy for all requests.

For reporting issues visit https://github.com/bvanelli/crpy

Installation

You can install it from the official pip repository:

pip install crpy

If you want to live on the edge and have the latest development features, install it directly from the repo:

pip install git+https://github.com/bvanelli/crpy.git

Why creating this package?

Essentially, I wanted to learn how docker handles docker image pushing and pulling, and I ended up also implementing functions that docker-cli does not address like listing repositories, deleting tags, etc. If you want to understand what is going on under the hood, take a look at this great article that delves over how containers are built and pushed.

I understand that there are many other good solutions out there, I'll list them here:

  • DXF (python): module with command line to interact with the registry. While some functionality is the same, DXF does not allow to pull and save entire images, only blobs. This means images will not run again once pulled from the registry.
  • docker-ls (go): module with command line to manipulate docker registries, focusing on listing repositories and tags. Also allows removal of tags, but does not allow pushing and pulling.
  • registry-cli (python): module with command line to manipulate docker registries. Allows removal of tags by regex, with configurable filters and number of images to keep. but does not allow pushing and pulling. Also, the codebase was written without type-hinting, which makes using it as an API a bit more difficult.

There are also production-ready solutions:

  • skopeo (go): very wide range of supported registries and formats. It also implements interactions with the docker daemon, so that you can interact even with already pulled images. It can also inspect repositories, manifests and configs.
  • crane (go): also very wide of support of registry interaction. Seems to also focus on the efficiency of doing operations.

I see nothing wrong with the available solutions, but if you are looking for a code based approach, you want to use python AND you want to use async code (like every other cool kid on the block), there are no real alternatives to interact with registries. Therefore, I started this little project to fill the gap.

If you know of any other alternative tools, feel free to open an issue or directly place a merge request editing this README.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

crpy-0.0.1.tar.gz (16.3 kB view details)

Uploaded Source

Built Distribution

crpy-0.0.1-py3-none-any.whl (17.1 kB view details)

Uploaded Python 3

File details

Details for the file crpy-0.0.1.tar.gz.

File metadata

  • Download URL: crpy-0.0.1.tar.gz
  • Upload date:
  • Size: 16.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/4.0.2 CPython/3.11.5

File hashes

Hashes for crpy-0.0.1.tar.gz
Algorithm Hash digest
SHA256 e596886797b860d965fefb13d32908033e4c26bb9aac524d30d2a5307e8aca4a
MD5 05fe3791088e6a8eec766e6395c20a2c
BLAKE2b-256 9b937b00a5cc58e3b2b68557a5d8435afb9fc130c8658060c133fd19e2ac9cb9

See more details on using hashes here.

File details

Details for the file crpy-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: crpy-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 17.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/4.0.2 CPython/3.11.5

File hashes

Hashes for crpy-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 efe977e617bfd28c72faaffca5c8c62eae4f15aa863d658792906f8d1e3d9d78
MD5 f429b66c5703b0d82791f987058a9cea
BLAKE2b-256 abbc4232507fddd69b75a03df8ab5f26ebaa37bf2e96524595cee972367625f3

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page