GithubHelp home page GithubHelp logo

doytsujin / regclient Goto Github PK

View Code? Open in Web Editor NEW

This project forked from regclient/regclient

0.0 1.0 0.0 3.22 MB

Docker and OCI Registry Client in Go and tooling using those libraries.

License: Apache License 2.0

Go 99.34% Shell 0.14% Makefile 0.51%

regclient's Introduction

regclient

GitHub Workflow Status GitHub Workflow Status GitHub Go Reference

Client interface for the registry API. This includes regctl for a command line interface to manage registries.

regctl demo

regctl Features

  • Ability to inspect repo tags, manifests, and image configs without downloading the full image.
  • Ability to copy or retag an image without pulling it into docker. Layers are only pulled if you are copying between different registries and the target registry does not have the layers already.
  • Ability to copy all platforms of a multi-platform image.
  • Ability to import an image to a registry from a tar file (OCI or Docker formatted).
  • Ability to export an image from a registry to a tar file (using a combined OCI and Docker format).
  • Ability to delete an image manifest.
  • Ability to delete a tag without removing the entire manifest.
  • Uses docker registry logins and /etc/docker/certs.d by default to support private repositories and self signed registries.
  • Shows current usage of Docker Hub's rate limit.

regsync features

  • Ability to copy or retag an image without pulling it into docker. Layers are only pulled if you are copying between different registries and the target registry does not have the layers already.
  • Ability to copy all platforms of a multi-platform image.
  • Mirrors repositories or images based on a yaml configuration.
  • Can use user's docker configuration for registry credentials.
  • Ability to run on a cron schedule, one time synchronization, or only check for stale images.
  • Ability to backup previous target image before overwriting.
  • Ability to postpone mirror step when rate limit is below a threshold.
  • Ability to mirror multiple images concurrently.

regbot features

  • Runs user provided scripts based on a yaml configuration.
  • Scripts are written in Lua and executed directly in Go.
  • Can run on a cron schedule or a one time execution.
  • Dry-run option can be used for testing.
  • Built-in functions include:
    • Repository list
    • Tag list
    • Image manifest (either head or get, and optional resolving multi-platform reference)
    • Image config (this includes the creation time, labels, and other details shown in a docker image inspect)
    • Image ratelimit and a wait function to delay the script when ratelimit remaining is below a threshold
    • Image copy
    • Manifest delete
    • Tag delete

Development Status

This project is in active development, a few features are not complete. Unfinished or not yet started work includes:

  • Ability to retry from a partial layer download.
  • Documentation.
  • Testing.

Building

git clone https://github.com/regclient/regclient.git
cd regclient
go build -o regctl ./cmd/regctl/

Downloading Binaries

Binaries are available on the releases page.

The latest release can be downloaded using curl (adjust "regctl" and "linux-amd64" for the desired command and your own platform):

curl -L https://github.com/regclient/regclient/releases/latest/download/regctl-linux-amd64 >regctl
chmod 755 regctl

Running as a Container

You can run regctl, regsync, and regbot in a container.

For regctl:

docker container run -it --rm --net host \
  -v regctl-conf:/home/appuser/.regctl/ \
  regclient/regctl:latest --help

For regsync:

docker container run -it --rm --net host \
  -v "$(pwd)/regsync.yml:/home/appuser/regsync.yml" \
  regclient/regsync:latest -c /home/appuser/regsync.yml check

For regbot:

docker container run -it --rm --net host \
  -v "$(pwd)/regbot.yml:/home/appuser/regbot.yml" \
  regclient/regbot:latest -c /home/appuser/regbot.yml once --dry-run

Or on Linux and Mac environments, you can run regctl as your own user and save configuration settings, use docker credentials, and use any docker certs:

docker container run -it --rm --net host \
  -u "$(id -u):$(id -g)" -e HOME -v $HOME:$HOME \
  -v /etc/docker/certs.d:/etc/docker/certs.d:ro \
  regclient/regctl:latest --help

And regctl can be packaged as a shell script with:

cat >regctl <<EOF
#!/bin/sh

docker container run -it --rm --net host \\
  -u "\$(id -u):\$(id -g)" -e HOME -v \$HOME:\$HOME \\
  -v /etc/docker/certs.d:/etc/docker/certs.d:ro \\
  regclient/regctl:latest "\$@"
EOF
chmod 755 regctl
./regctl --help

Installing as a Docker CLI Plugin

To install regctl as a docker CLI plugin:

make plugin-user # install for the current user
make plugin-host # install for all users on the host (requires sudo)

Once installed as a plugin, you can access it from the docker CLI:

$ docker regctl --help
Utility for accessing docker registries
More details at https://github.com/regclient/regclient

Usage:
  regctl <cmd> [flags]
  regctl [command]

Available Commands:
  help        Help about any command
  image       manage images
  layer       manage image layers/blobs
  registry    manage registries
  tag         manage tags
...

Usage

See the project documentation.

Comparison to Other Tools

Registry client API:

  • containerd: containerd'd registry APIs focus more on pulling images than on a general purpose registry client API. This means various registry API calls are not provided.
  • distribution/distribution: The distribution project is focused on the server side of the registry API. There are a few client API's, but they appear to be intended for internal use.

There are also a variety of registry command line tools available:

  • genuinetools/img: img works on top of buildkit for image creation and management. Using this for a registry client means including lots of dependencies that many will not need.
  • genuinetools/reg: reg is probably the closest match to this project. Some features included in regctl that aren't included in reg are the ability to inject self signed certs, store login credentials separate from docker, copy or retag images, and export images into a tar file.
  • containers/skopeo: Because of RedHat's push to remove any docker solutions from their stack, their skopeo project wasn't considered when searching for a complement to docker's tooling.

regclient's People

Contributors

sudo-bmitch avatar crazy-max avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.