npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

docker-registry-rquery

v0.0.1

Published

A read-only SQL-like interface for docker v2 registry

Downloads

3

Readme

dockerql

:warning: The project is under active development: Be careful how you use it at this time.

A read-only SQL-like interface for docker registries. Currently this project is under development and is ready for experimentation usage only.

Why

SQL-like query interfaces is still one of the easiest to understand interface to query databases. We are still missing something like that for docker registries. In addition, each docker implementation is a bit different in terms of its authentication, scoping, and features. dockerql provides a unified yet extendable way to access multiple types of registries.

Supported registry types

Currently supported:

  1. Dockerhub
  2. Google Container Registry (GCR)

Supported SQL statements

Example SQL supported queries:

SELECT * FROM registries
SELECT * FROM namespaces WHERE registry = {registry}
SELECT * FROM repos WHERE registry = {registry} 
SELECT * FROM images WHERE registry = {registry} AND repo = {repo}

Access to public repos/images

dockerql supports access to public repos for both dockerhub and gcr. We do that by providing namespace value in the WHERE clause.

Here are simple examples:

  • Find the repos under alpine in dockerhub
SELECT * FROM repos WHERE registry = "my-dockerhub" AND namespace = "alpine"
  • Find the repos under distroless in gcr
SELECT * FROM repos WHERE registry = "my-gcr" AND namespace = "distroless"

Authentication to dockerql

dockerql is a read-only service that is open for any user with access to the service. There is no native support for authentication to the service. The assumption is that the dockerql is started in a "safe" place, security is handled by your choice of tools before reaching the docekrql service.

Getting Started

Few steps to get dockerql up and running:

  1. Configure access to your registries.
  2. Select a method to run dockerql as a local server from npmjs, as a standalone docker container, or as kubernetes pod. Still under development.
  3. Try the query api.

Configure access to your registries

Credentials are configured in JSON format and passed to dockerql via an environment variable or via a config file. If both are setup then the environment variable wins.

  1. Env variable called: "DOCKER_REGISTRIES" contains json document with the configuration.
  2. if not set then using env variable called: "DOCKER_REGISTRIES_FILE" that points to the location of the configuration file.
  3. If not set then try a default location for the configuration file at "./.registries.json".
  4. If file not found then used a built in default that set up access to dockerhub with no credentials.

The JSON format is as follows:

{
    "default-registry": {{default}},
    "registries": []
}
  • {{default}} - a default registry to be used if WHERE clause does not include a registry name.
  • The registries area includes the access definition for each registry and it is dependent on the registry type.

Configure access to Docker Hub

The following example access docker hub.

{
  "default-registry": {registryName},
  "registries": [
    {
      "name": {registryName},
      "type": "dockerhub",
      "namespace": {namespace},
      "username": {username},
      "password": {password}
    }
  ]
}
  • {registryName} is an arbitrary name you choose to represent the registry. The name must be unique in the config file.
  • {namespace} optional parameter. Mapped to dockerhub "organization".

Configure access to Google Container Registry (GCR)

{
  "default-registry": {registryName},
  "registries": [
    {
      "name": {registryName},
      "type": "gcr",
      "namespace": {namespace},
      "username": "_json_key",
      "password": {jsonkey}
    }
  ]
}
  • {registryName} is an arbitrary name you choose to represent the registry. The name must be unique in the config file.
  • {namespace} optional parameter. Mapped to gcr project-id.
  • {jsonkey} is a gcp service account with permissions Project Browser, Storage Object Viewer on the GCS bucket for the container registry (bucket name: artifacts..appspot.com).

Technology

Few things we can say about the project:

  1. Available as open source under the MIT license.
  2. Built with Node.JS, TypeScript, OpenAPI, and multiple OSS packages that makes development life better.
  3. Packaged in multiple form factors, including a docker image.

Parking area

    "build:docs": "./node_modules/redoc-cli/index.js bundle ./openapi.json -o ./openapi.html;./node_modules/redoc-cli/index.js bundle ./schema.json -o ./schema.html",
  1. Running inside Kubernetes (TODO)

  2. Define a secret with the registry credentials

kubectl create secret dockerdl-registry "$(cat ~/.registry.json)" 
  1. Define a kube pod for dockerql