docker

package module
v1.7.3 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: BSD-2-Clause Imports: 13 Imported by: 0

README

Docker-Utils

Package provide some docker utils

List remote images

go get github.com/bborbe/docker-utils/cmd/docker-remote-repositories

docker-remote-repositories \
-registry=docker.benjamin-borbe.de \
-username=bborbe \
-password=xxx \
-alsologtostderr \
-v=0

List tags of remote image

go get github.com/bborbe/docker-utils/cmd/docker-remote-tags

docker-remote-tags \
-registry=docker.benjamin-borbe.de \
-username=bborbe \
-password=xxx \
-repository=bborbe/auth-http-proxy \
-alsologtostderr \
-v=0

Check if remote image with tag exists

go get github.com/bborbe/docker-utils/cmd/docker-remote-tag-exists

docker-remote-tag-exists \
-registry=docker.benjamin-borbe.de \
-username=bborbe \
-password=xxx \
-repository=bborbe/auth-http-proxy \
-tag=1.0.1 \
-alsologtostderr \
-v=0

Delete image tag

go get github.com/bborbe/docker-utils/cmd/docker-remote-tag-delete

docker-remote-tag-delete \
-registry=docker.benjamin-borbe.de \
-username=bborbe \
-password=xxx \
-repository=bborbe/auth-http-proxy \
-tag=1.0.1 \
-alsologtostderr \
-v=0

Delete old images on Dockerhub

go get github.com/bborbe/docker-utils/cmd/dockerhub-cleaner

dockerhub-cleaner \
-username bborbe \
-password xxx

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DockerHubClient

type DockerHubClient interface {
	ListRepositories(ctx context.Context, repositoryName RepositoryName, ch chan<- DockerHubTagRepository) error
	ListTags(ctx context.Context, repositoryName RepositoryName, ch chan<- DockerHubTag) error
	DeleteTag(ctx context.Context, repositoryName RepositoryName, tag TagName) error
}

func NewDockerHubClient

func NewDockerHubClient(
	httpClient HttpClient,
	registry Registry,
) DockerHubClient

type DockerHubTag

type DockerHubTag struct {
	Tag         TagName `json:"name"`
	LastUpdated string  `json:"last_updated"`
}

type DockerHubTagRepository

type DockerHubTagRepository struct {
	User string `json:"user"`
	Name string `json:"name"`
}

func (DockerHubTagRepository) RepositoryName

func (d DockerHubTagRepository) RepositoryName() RepositoryName

type HttpClient

type HttpClient interface {
	Do(ctx context.Context, req *http.Request) (*http.Response, error)
	DoSuccess(ctx context.Context, req *http.Request) (*http.Response, error)
	DoJSON(ctx context.Context, req *http.Request, data interface{}) error
}

func NewHttpClient

func NewHttpClient(client *http.Client) HttpClient

type Manifest

type Manifest struct {
	SchemaVersion int              `json:"schemaVersion"`
	MediaType     string           `json:"mediaType"`
	Config        ManifestConfig   `json:"config"`
	Layers        []ManifestConfig `json:"layers"`
}

type ManifestConfig

type ManifestConfig struct {
	MediaType string `json:"mediaType"`
	Size      int    `json:"size"`
	Digest    string `json:"digest"`
}

type Registry

type Registry struct {
	Url      string
	Username string
	Password string
}

func (*Registry) RegistryPasswordFromFile

func (r *Registry) RegistryPasswordFromFile(path string) error

type Repository

type Repository struct {
	Name RepositoryName
	Tag  TagName
}

type RepositoryName

type RepositoryName string

func (RepositoryName) String

func (r RepositoryName) String() string

type RepositoryNamesByName

type RepositoryNamesByName []RepositoryName

func (RepositoryNamesByName) Len

func (t RepositoryNamesByName) Len() int

func (RepositoryNamesByName) Less

func (t RepositoryNamesByName) Less(i, j int) bool

func (RepositoryNamesByName) Swap

func (t RepositoryNamesByName) Swap(i, j int)

type TagName

type TagName string

func (TagName) String

func (t TagName) String() string

type TagsByName

type TagsByName []TagName

func (TagsByName) Len

func (t TagsByName) Len() int

func (TagsByName) Less

func (t TagsByName) Less(i, j int) bool

func (TagsByName) Swap

func (t TagsByName) Swap(i, j int)

type V2Client

type V2Client interface {
	ListRepositories(ctx context.Context, ch chan<- RepositoryName) error
	DeleteTag(ctx context.Context, repositoryName RepositoryName, tag TagName) error
	ExistsTag(ctx context.Context, repositoryName RepositoryName, tag TagName) (bool, error)
	ListTags(ctx context.Context, repositoryName RepositoryName, ch chan<- TagName) error
	Sha(ctx context.Context, repositoryName RepositoryName, tag TagName) (string, error)
	Manifest(ctx context.Context, repositoryName RepositoryName, tag TagName) (*Manifest, error)
}

func NewV2Client

func NewV2Client(
	httpClient HttpClient,
	registry Registry,
) V2Client

Jump to

Keyboard shortcuts

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