godt

package module
v0.0.0-...-096c606 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2019 License: BSD-3-Clause Imports: 6 Imported by: 0

README

godt - Go Docker Tag

godt -- Go library for getting docker image tags

Build Status Go Report Card

Why godt?

At this time, there's no way to get image tags from docker client. We can use any HTTP client to get tags from docker hub:

curl https://registry.hub.docker.com//v1/repositories/fedora/tags | python -mjson.tool

It's too complicated from user perspective, so godt come in for simplification

Installation

go get -u github.com/cuonglm/godt

Usage

import "github.com/cuonglm/godt"

Example can be seen in bin/docker-tags-v1

$ go build docker-tags-v1.go
$ docker-tags-v1 -image alpine
latest
2.6
2.7
3.1
3.2
3.3
edge

Environment variables

You can use GODT_HUB_API_VERSION and GODT_HUB_URL environment variable to change the docker hub version and url. Example with docker-tags-v1:

$ GODT_HUB_API_VERSION=2 ./docker-tags-v1
The requested URL (/v2//tags/list) was not found on this server.

By default, GODT_HUB_API_VERSION is 1 and GODT_HUB_URL is https://registry.hub.docker.com

Note

Currently, authentication is not supported.

Author

Cuong Manh Le cuong.manhle.vn@gmail.com

License

See LICENSE

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	UserAgent  string
	APIVersion string
	HubURL     *url.URL
	// contains filtered or unexported fields
}

Client for querying docker hub API

func NewHTTPClient

func NewHTTPClient(client *http.Client) *Client

NewHTTPClient create new godt client

func (*Client) Do

func (c *Client) Do(req *http.Request) (resp *http.Response, err error)

Do make an http request

func (*Client) ListTags

func (c *Client) ListTags(image string) (*http.Response, error)

ListTags list all image tags

func (*Client) NewRequest

func (c *Client) NewRequest(method, path string, body interface{}) (*http.Request, error)

NewRequest create new http request

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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