Skip to content

olareg/olareg

olareg

Go Workflow Status Docker Workflow Status CI & Conformance Status Dependency Workflow Status Vulnerability Workflow Status

Go Reference License OpenSSF Scorecard

olareg (pronounced oh-la-reg) is a minimal OCI conformant container registry. It is designed around the OCI Layout structure for storing images in a directory. The minimal nature includes avoiding external dependencies, making the project easy to embed in unit tests or deployed in an edge environment as a cache.

Running as a Container

With persistent storage:

docker run -p 5000:5000 \
  -v "olareg-data:/home/appuser/registry" \
  ghcr.io/olareg/olareg serve --dir /home/appuser/registry

For an ephemeral registry:

docker run -p 5000:5000 --rm \
  ghcr.io/olareg/olareg serve --store-type mem

Installing as a Binary

Binaries can be downloaded from the releases page.

Downloading the latest release for linux/amd64 can be done with curl:

curl -L https://github.com/olareg/olareg/releases/latest/download/olareg-linux-amd64 >olareg
chmod 755 olareg

For binaries downloaded on MacOS, the quarantine attribute can be removed with:

xattr -d com.apple.quarantine olareg

Using in Go Unit Tests

One of the goals of olareg was to serve as a simple registry implementation to test tooling that works with container registries. Integrating it into unit tests with the httptest based server involves the following setup:

func TestMethod(t *testing.T) {
  rh := olareg.New(config.Config{
		Storage: config.ConfigStorage{
			StoreType: config.StoreMem,
			RootDir:   "./testdata", // serve content from testdata, writes only apply to memory
		},
	})
  ts := httptest.NewServer(rh)
  t.Cleanup(func() {
    ts.Close()
    _ = rh.Close()
  })
  tsURL, err := url.Parse(ts.URL)
  if err != nil {
    t.Fatal("failed to parse url %s: %v", ts.URL, err)
  }
  // send requests to tsURL.Host registry server ...
}

Verifying Signatures

Binaries and images have been signed with cosign.

For images:

cosign verify \
  --certificate-oidc-issuer https://token.actions.githubusercontent.com \
  --certificate-identity-regexp https://github.com/olareg/olareg/.github/workflows/ \
  ghcr.io/olareg/olareg:latest

For binaries:

curl -L https://github.com/olareg/olareg/releases/latest/download/olareg-linux-amd64 >olareg
chmod 755 olareg
curl -L https://github.com/olareg/olareg/releases/latest/download/olareg-linux-amd64.pem >olareg-linux-amd64.pem
curl -L https://github.com/olareg/olareg/releases/latest/download/olareg-linux-amd64.sig >olareg-linux-amd64.sig
cosign verify-blob \
  --certificate-oidc-issuer https://token.actions.githubusercontent.com \
  --certificate-identity-regexp https://github.com/olareg/olareg/.github/workflows/ \
  --certificate olareg-linux-amd64.pem \
  --signature olareg-linux-amd64.sig \
  olareg
rm olareg-linux-amd64.pem olareg-linux-amd64.sig