Coder Social home page Coder Social logo

glensc / zoobab-docker-ls Goto Github PK

View Code? Open in Web Editor NEW

This project forked from zoobab/docker-ls

0.0 1.0 0.0 3.13 MB

Tools for browsing and manipulating docker registries.

License: MIT License

Dockerfile 0.45% Makefile 2.89% Shell 15.18% Go 81.48%

zoobab-docker-ls's Introduction

About registry-ls

The author of Docker-ls refused patches with those shell scripts on top of docker-ls, so here they are.

They are very useful if you want to do shell scripting on top of them.

Note: this script will only work with this patched version of docker-ls, as of today, the mayflower's one does not support the env var DOCKER_REGISTRY_URL, see mayflower#8

Prebuilt Docker Image

If you want to use a prebuilt docker image hosted on the Docker Hub:

$ docker run -it -e DOCKER_REGISTRY_URL=https://myregistry.zoobab.com zoobab/docker-ls registry-ls
busybox:latest
busybox:one
busybox:two

You can also pass login and password:

$ docker run -it -e DOCKER_REGISTRY_URL=https://myregistry2.zoobab.com -e DOCKER_REGISTRY_LOGIN=mylogin -e DOCKER_REGISTRY_PWD=mypwd zoobab/docker-ls registry-ls
busybox:latest
busybox:one
busybox:two

Delete a tag (beware that this only deletes the tag, you have to run a garbage collector registry side to free the disk space):

$ docker run -it -e DOCKER_REGISTRY_URL=https://myregistry2.zoobab.com zoobab/docker-ls registry-rmtag busybox:latest
Deleting tag busybox:latest ...Tag deleted successfully!

Get the sha256 hash of the image:

$ docker run -it -e DOCKER_REGISTRY_URL=https://myregistry2.zoobab.com zoobab/docker-ls registry-lslayers busybox:latest
sha256:8489df91d70f35bddb5648f5931807146285a513a034a627fa1efbf4ba4357e7

Dependencies

  • docker-ls
  • docker-rm
  • jq ( >= 1.4 )
  • grep
  • echo

Usage

In order to use those scripts, you need to set first the address of the registry as an environement variable:

$ export DOCKER_REGISTRY_URL="https://mydocker.registry.com"

If you need a login+password to access your registry, you can also set them:

$ export DOCKER_REGISTRY_LOGIN="mylogin"
$ export DOCKER_REGISTRY_PWD="mypassword"

Install

To install those scripts, just do a make install:

$ cd scripts/
$ make install
sudo cp -v registry-ls registry-rmtag registry-lslayers ../bin/docker-ls ../bin/docker-rm /usr/local/bin/
'registry-ls' -> '/usr/local/bin/registry-ls'
'registry-rmtag' -> '/usr/local/bin/registry-rmtag'
'registry-lslayers' -> '/usr/local/bin/registry-lslayers'
'../bin/docker-ls' -> '/usr/local/bin/docker-ls'
'../bin/docker-rm' -> '/usr/local/bin/docker-rm'
sudo chmod 755 /usr/local/bin/{registry-ls,registry-rmtag,registry-lslayers,docker-ls,docker-rm}

Screenshots

List contents of a registry with output one repo:tag per line:

$ registry-ls
busybox:one
busybox:two
busybox:three
busybox:four

Remove a tag:

$ registry-rmtag busybox:latest
Deleting tag busybox:latest ...Tag deleted successfully!

Combine both to delete all tags:

$ for i in `registry-rmtag`; do registry-rmtag $i; done
Deleting tag busybox:one ...Tag deleted successfully!
Deleting tag busybox:two ...Tag deleted successfully!
Deleting tag busybox:three ...Tag deleted successfully!
Deleting tag busybox:four ...Tag deleted successfully!

Check that the registry is empty:

$ registry-ls
$ 

Get the sha256 hash of the image (useful to see if for ex "myimage:latest" has changed):

$ registry-lslayers busybox:latest
sha256:8489df91d70f35bddb5648f5931807146285a513a034a627fa1efbf4ba4357e7

zoobab-docker-ls's People

Contributors

dirtyhairy avatar zoobab avatar msabramo 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.