registryfrontend

package module
v0.0.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 9, 2018 License: MIT Imports: 11 Imported by: 0

README

A docker registry v2 frontend written in Go

There are many other frontends for the docker registry out there. The best one I have found yet, is docker-registry-frontend by Max Brenner.

The only downside to the above solution, is that the provided image is very large, and that it runs single-threaded in the Flask development server.

Therefore I decided to make a simple docker registry v2 frontend myself, greatly inspired by the above service. While my version does not offer all of the same features, it has the benefit of taking up very little space, while still providing a service that can be used by multiple viewers at the same time.

The source can be found at GitHub: https://github.com/mikaellindemann/registryfrontend.

The images can be pulled from Docker Hub: https://hub.docker.com/r/mikaellindemann/registryfrontend.

Features

Currently, the frontend supports multiple docker registry v2 instances, that are publicly available or protected by Basic authentication.

One registry can be added on startup by using the following environment variables:

Name Description
REGISTRY_NAME The identifier used in the URL when viewing information about the registry and it's content.
REGISTRY_URL The URL poiting to the registry.
REGISTRY_AUTH_BASIC_USER The Basic authentication username.
REGISTRY_AUTH_BASIC_PASSWORD The Basic authentication password.

Note that the registry will only be added if the name contains only legal characters (a-z and 0-9) and if both a name and URL is provided.

Registries added through the frontend, will currently not be persisted on restart of the frontend.

Known issues/bugs

  • If multiple users are adding or removing registries in the same instance, the service might panic due to no serialized access to the in-memory storage.

Pull requests and issues are very welcome.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrIllegalName      = errors.New("illegal character in registry name")
	ErrRegistryNotFound = errors.New("registry not found")
)

Functions

func CacheOrGetLayerSize

func CacheOrGetLayerSize(ctx context.Context, rs distribution.Repository, d digest.Digest) (int64, error)

Types

type BasicAuthTransport

type BasicAuthTransport struct {
	Transport http.RoundTripper
	URL       string
	Username  string
	Password  string
}

func NewBasicAuthRoundTripper

func NewBasicAuthRoundTripper(url, user, password string) *BasicAuthTransport

func (*BasicAuthTransport) RoundTrip

func (t *BasicAuthTransport) RoundTrip(req *http.Request) (*http.Response, error)

type MemoryStorage

type MemoryStorage map[string]Registry

func NewInMemoryStorage

func NewInMemoryStorage() *MemoryStorage

func (*MemoryStorage) Add

func (m *MemoryStorage) Add(r Registry) error

func (*MemoryStorage) Clear

func (m *MemoryStorage) Clear() error

func (*MemoryStorage) Registries

func (m *MemoryStorage) Registries() ([]Registry, error)

func (*MemoryStorage) Registry

func (m *MemoryStorage) Registry(name string) (Registry, error)

func (*MemoryStorage) Remove

func (m *MemoryStorage) Remove(r Registry) error

func (*MemoryStorage) Update

func (m *MemoryStorage) Update(r Registry) error

type Registry

type Registry struct {
	Name     string `json:"name"`
	Url      string `json:"url"`
	User     string `json:"user,omitempty"`
	Password string `json:"password,omitempty"`
}

func (Registry) Repositories

func (r Registry) Repositories(ctx context.Context) ([]string, error)

func (Registry) Tag

func (r Registry) Tag(ctx context.Context, repo, tag string) (*TagInfo, error)

func (Registry) Tags

func (r Registry) Tags(ctx context.Context, repo string) ([]string, error)

type Storage

type Storage interface {
	Registries() ([]Registry, error)
	Registry(name string) (Registry, error)
	Add(r Registry) error
	Update(r Registry) error
	Clear() error
	Remove(r Registry) error
}

type TagInfo

type TagInfo struct {
	Created       time.Time
	DockerVersion string
	EntryPoint    []string
	ExposedPorts  []string
	Layers        int
	Size          int64
	User          string
	Volumes       []string
}

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL