Skip to content

Simple Registry — A lightweight, Docker Registry API-compatible server for managing container images with blob, manifest, and tag support. Easy to deploy, extend, and integrate with Docker clients. Supports configurable ports, verbose logging, and thread-safe operations.

License

Notifications You must be signed in to change notification settings

nilspolek/simple-reg

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Simple Registry

Simple Registry is a lightweight implementation of a Docker Registry API. It provides endpoints for managing blobs, manifests, and tags in a Docker-compatible registry. This project is designed to be simple and extensible, making it suitable for small-scale deployments or as a starting point for custom registry implementations.

Features

  • Blob Management: Upload, patch, finalize, and retrieve blobs.
  • Manifest Management: Create, retrieve, and delete manifests.
  • Tag Management: List tags for repositories.
  • Docker-Compatible API: Implements Docker Registry API endpoints.
  • Logging: Integrated logging using zerolog.
  • Thread-Safe Operations: Ensures thread safety for blob and manifest operations.
  • Configurable Port and Verbosity: Use -port to set the server port and -verbose for detailed logs.

Directory Structure

  • internal/server/blob-service/: Contains the implementation for blob-related operations.
  • internal/server/manifest-service/: Contains the implementation for manifest-related operations.
  • internal/server/simple-server/: Contains the HTTP handlers for the registry endpoints.
  • internal/server/: Contains shared utilities and the main server implementation.

Installation

  1. Clone the repository:

    git clone https://github.com/nilspolek/simple-reg.git
    cd simple-reg
  2. Build the project:

    go build -o bin/simple-reg cli/simple-reg/main.go
  3. Run the server (default port: 5000):

    ./bin/simple-reg -port 5000 -verbose
    • Use -port to set a custom port (default is 5000)
    • Use -verbose to enable verbose (debug-level) logging

Install with Go

To install the application using Go, run the following command:

go install github.com/nilspolek/simple-reg/cli/simple-reg@latest

To run the application:

simple-reg -port 5000 -verbose

API Endpoints

Blob Endpoints

  • Start Upload: POST /v2/{name}/blobs/uploads/
  • Patch Blob: PATCH /v2/{name}/blobs/uploads/{id}
  • Finalize Upload: PUT /v2/{name}/blobs/uploads/{id}?digest=sha256:<digest>
  • Get Blob: GET /v2/{name}/blobs/{digest}
  • Blob Headers: HEAD /v2/{name}/blobs/{digest}

Manifest Endpoints

  • Create Manifest: PUT /v2/{name}/manifests/{reference}
  • Get Manifest: GET /v2/{name}/manifests/{reference}
  • Delete Manifest: DELETE /v2/{name}/manifests/{reference}

Tag Endpoints

  • List Tags: GET /v2/{name}/tags/list
  • List All Tags: GET /v2/tags/list

Logging

The logging system is integrated using zerolog. It provides structured logging capabilities and can be configured to output logs in JSON format for easy parsing and analysis.

  • Use -verbose to enable debug-level logs.
  • Default log output is in structured JSON.

Docker Integration

You can use the Docker CLI to interact with your Simple Registry server.

Push an Image

  1. Tag the image:

    docker tag alpine localhost:5000/myrepo/alpine:latest
  2. Push the image:

    docker push localhost:5000/myrepo/alpine:latest

    Make sure the server is running and accessible on the specified port.

Pull an Image

  1. Pull the image:

    docker pull localhost:5000/myrepo/alpine:latest

💡 You may need to configure your Docker daemon to allow insecure registries for localhost:5000 by editing your Docker daemon config:

{
  "insecure-registries": ["localhost:5000"]
}

Then restart Docker.

About

Simple Registry — A lightweight, Docker Registry API-compatible server for managing container images with blob, manifest, and tag support. Easy to deploy, extend, and integrate with Docker clients. Supports configurable ports, verbose logging, and thread-safe operations.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages