Nodevisor Docs
Packages

@nodevisor/registry

Abstract container registry interface for Docker image management.

Install

npm install @nodevisor/registry

Defines the abstract Registry class that all container registry implementations extend. You typically use concrete implementations like DockerRegistry, DockerRegistryLocal, or ECR.


Usage

import Registry from '@nodevisor/registry';

// Static helpers — work without a registry instance
const tag = Registry.getTag('myapp:v1.0');         // "v1.0"
const image = Registry.getImage('myapp:v1.0');      // "myapp"
const full = Registry.getImageWithTag('myapp');      // "myapp:latest"
const hasTag = Registry.hasTag('myapp:v1.0');        // true

Static Methods

Registry.getTag(image, defaultTag?)

Extract the tag from an image name.

Registry.getTag('myapp:v1.0');         // "v1.0"
Registry.getTag('myapp');              // undefined
Registry.getTag('myapp', 'dev');       // "dev"

Registry.getImage(image)

Extract the image name without the tag.

Registry.getImage('myapp:v1.0');       // "myapp"
Registry.getImage('ghcr.io/org/app');  // "ghcr.io/org/app"

Registry.getImageWithTag(image, defaultTag?)

Get the full image name with tag.

Registry.getImageWithTag('myapp');           // "myapp:latest"
Registry.getImageWithTag('myapp:v1.0');      // "myapp:v1.0"
Registry.getImageWithTag('myapp', 'dev');    // "myapp:dev"

Registry.hasTag(image)

Check if an image string includes a tag.

Registry.hasTag('myapp:v1.0');  // true
Registry.hasTag('myapp');        // false

Abstract Methods

These must be implemented by concrete registries:

MethodDescription
push(image, options?)Push an image to the registry
login($con)Authenticate to the registry on a connection
getLoginCredentials()Get authentication credentials

Implementations

ClassPackageUse case
DockerRegistry@nodevisor/dockerDocker Hub, GitHub Container Registry, etc.
DockerRegistryLocal@nodevisor/dockerLocal development (no remote push)
ECR@nodevisor/awsAWS Elastic Container Registry
import { DockerRegistry } from '@nodevisor/docker';

const registry = new DockerRegistry({
  server: 'ghcr.io',
  username: 'myorg',
  password: process.env.GITHUB_TOKEN!,
});

On this page