dockerconfig

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: May 10, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package dockerconfig builds and parses Kubernetes `.dockerconfigjson` payloads for imagePullSecret Secrets of type kubernetes.io/dockerconfigjson.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Build

func Build(creds []RegistryCredential) ([]byte, error)

Build encodes the given credentials into a canonical `.dockerconfigjson` byte slice. It computes the `auth` field (base64("user:pass")) automatically and rejects empty input.

Types

type DockerAuthEntry

type DockerAuthEntry struct {
	Username string `json:"username,omitempty"`
	Password string `json:"password,omitempty"`
	Auth     string `json:"auth,omitempty"`
}

DockerAuthEntry is one entry under auths[registry].

type DockerConfig

type DockerConfig struct {
	Auths map[string]DockerAuthEntry `json:"auths"`
}

DockerConfig is the top-level shape of .dockerconfigjson.

type RegistryCredential

type RegistryCredential struct {
	Registry string
	Username string
	Password string
}

RegistryCredential is a single registry auth entry.

func Parse

func Parse(data []byte) ([]RegistryCredential, error)

Parse decodes a `.dockerconfigjson` payload back into a flat list of credentials. The `auth` field is trusted only when username/password are missing; otherwise the explicit username/password are preferred.

Jump to

Keyboard shortcuts

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