Skip to content

jcarter3/oci

 
 

Repository files navigation

OCI Go modules

This repository holds functionality related to OCI (Open Container Initiative).

The top level package (oci) this module defines a Go interface that encapsulates the operations provided by an OCI registry.

Full reference documentation can be found here.

It also provides a lightweight in-memory implementation of that interface (ocimem) and an HTTP server that implements the OCI registry protocol on top of it.

The server currently passes the conformance tests.

The aim is to provide an ergonomic interface for defining and layering OCI registry implementations.

Although the API is fairly stable, it's still in v0 currently, so incompatible changes can't be ruled out.

The code was originally derived from cue-labs/oci which was originally derived from the go-containerregistry package, but has considerably diverged since then.

Usage

package main

import (
	"context"
	"fmt"

	"github.com/jcarter3/oci/ociauth"
	"github.com/jcarter3/oci/ociclient"
)

func main() {
	cf, err := ociauth.Load(nil)
	if err != nil {
		panic(err)
	}

	ocl, err := ociclient.New("index.docker.io", &ociclient.Options{
		Transport: ociauth.NewStdTransport(ociauth.StdTransportParams{
			Config: cf,
		}),
	})
	if err != nil {
		panic(err)
	}

	tags := ocl.Tags(context.Background(), "library/alpine", nil)
	for tag, err := range tags {
		if err != nil {
			panic(err)
		}
		fmt.Printf("%s\n", tag)
	}
}

About

Go modules related to OCI (Open Container Initiative) registries

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages

  • Go 99.6%
  • CUE 0.4%