package registry

import "github.com/google/go-containerregistry/pkg/registry"

Package registry implements a docker V2 registry and the OCI distribution specification.

It is designed to be used anywhere a low dependency container registry is needed, with an initial focus on tests.

Its goal is to be standards compliant and its strictness will increase over time.

This is currently a low flightmiles system. It's likely quite safe to use in tests; If you're using it in production, please let us know how and send us CL's for integration tests.

Example

Code:play 

package main

import (
	"fmt"
	"net/http/httptest"

	"github.com/google/go-containerregistry/pkg/registry"
)

func main() {
	s := httptest.NewServer(registry.New())
	defer s.Close()
	resp, _ := s.Client().Get(s.URL + "/v2/bar/blobs/sha256:...")
	fmt.Println(resp.StatusCode)
}

Output:

404

Index

Examples

Functions

func New

func New(opts ...Option) http.Handler

New returns a handler which implements the docker registry protocol. It should be registered at the site root.

func TLS

func TLS(domain string) (*httptest.Server, error)

TLS returns an httptest server, with an http client that has been configured to send all requests to the returned server. The TLS certs are generated for the given domain which should correspond to the domain the image is stored in. If you need a transport, Client().Transport is correctly configured.

Types

type Option

type Option func(r *registry)

Option describes the available options for creating the registry.

func Logger

func Logger(l *log.Logger) Option

Logger overrides the logger used to record requests to the registry.

Source Files

blobs.go error.go manifest.go registry.go tls.go

Version
v0.7.0
Published
Nov 12, 2021
Platform
js/wasm
Imports
19 packages
Last checked
2 hours ago

Tools for package owners.