dkrrmtag

package module
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2023 License: MPL-2.0 Imports: 14 Imported by: 0

README

dkr-rm-tag

dkr-rm-tag is a Go based CLI that can be used to remove a specific Docker image tag from a target registry.

Ideally, you would be able to use the docker CLI to implement this functionality, but as of March 24th, 2023, the docker CLI only offers the ability to remove image tags locally and not in the remote registry. Instead, each registry offers a proprietary API endpoint to implement this feature.

This CLI is meant to provide a single unified interface for removing image tags from various underlying registries.

Quick start

Use one of the following to download the dkr-rm-tag CLI:

  • Downloading one of the pre-compiled binaries from the releases page.

  • Building from source using go:

    go install github.com/fensak-io/dkr-rm-tag/cmd/dkr-rm-tag@latest
    

Once you have the CLI installed, you can run the command to remove a tag from one of the supported registries. For example, to remove the user/myrepo:some-tag tag from Docker Hub:

  export DOCKER_HUB_TOKEN='....your personal access token...'
dkr-rm-tag --tag 'user/myrepo:some-tag' --docker-hub-username user

Alternatively, to remove from ghcr.io:

  export GITHUB_TOKEN='...your personal access token...'
dkr-rm-tag --tag 'ghcr.io/user/myrepo:some-tag'

Refer to dkr-rm-tag --help for all the available options by the command.

Supported registries

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewDkrHubRegistry

func NewDkrHubRegistry(ctx context.Context, username, token string) (dkrHubRegistry, error)

NewDkrHubRegistry returns a handle to a new dkrHubRegistry object which can be used to make requests to the registry.

func NewGHCR

func NewGHCR(token string) ghcr

NewGHCR returns a handle to a new ghcr object which can be used to make requests to the registry (using the GraphQL API).

Types

type DeleteTagRequest

type DeleteTagRequest struct {
	RepositoryOwner string
	RepositoryName  string
	ImgTag          string
}

DeleteTagRequest specifies the image tag from a given repository that should be deleted from the registry.

type DockerRef

type DockerRef struct {
	Host  string
	Owner string
	Name  string
	Tag   string
}

func ParseDockerImgRef

func ParseDockerImgRef(ref string) (DockerRef, error)

ParseDockerImgRef parses the given user provided ref into the constituent parts. This handles the implicit rules implemented by the docker CLI, such as `rust` => `docker.io/library/rust`.

func (DockerRef) AsDeleteTagRequest

func (r DockerRef) AsDeleteTagRequest() DeleteTagRequest

type Registry

type Registry interface {
	// DeleteTag deletes a given image tag from the underlying docker registry.
	DeleteTag(context.Context, DeleteTagRequest) error
}

Registry provides an interface into a docker registry that supports deleting image tags.

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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