dockerPull

package module
v0.0.0-...-0fd6310 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2021 License: Apache-2.0 Imports: 25 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

go-docker-pull

The app makes it possible to download a docker-image without using docker

!!! Not working with v1 registry

Use

> git clone https://github.com/myback/go-docker-pull.git
> cd go-docker-pull
> go build -o bin/docker-pull -ldfalgs="-s -w" docker-pull/docker-pull.go
> bin/docker-pull -h
Usage:
  docker-pull image [image ...] [flags]

Flags:
  -a, --arch string       CPU architecture platform image (default "amd64")
  -h, --help              help for docker-pull
  -d, --only-download     Only download layers
  -o, --os string         OS platform image (default "linux")
  -p, --password string   Registry password
  -s, --save-cache        Do not delete the temp folder
  -u, --user string       Registry user

>
> bin/docker-pull alpine:3.10
3.10: Pulling from library/alpine
21c83c524219: Pull complete
Digest: sha256:a143f3ba578f79e2c7b3022c488e6e12a35836cd4a6eb9e363d7f3a07d848590
> docker pull alpine:3.10
> docker save alpine:3.10 -o alpine_3.10.tar
> sha256sum *.tar
d59b494721c87e7536ad6b68d9066b82b55b9697d89239adb56a6ba2878a042d  alpine_3.10.tar
d59b494721c87e7536ad6b68d9066b82b55b9697d89239adb56a6ba2878a042d  library_alpine_3.10.tar

Fetch multiple images

> bin/docker-pull alpine:3.10 ubuntu:18.04 bitnami/redis:5.0

Fetch image from private registry

> bin/docker-pull --user username --password 'P@$$w0rd' private-registry.mydomain.com/my_image:1.2.3

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrImageNotFound     = fmt.Errorf("pull access denied, repository does not exist or may require login and password")
	ErrEmptyManifestList = fmt.Errorf("empty manifest list")
)

Functions

func FileHashEqual

func FileHashEqual(filename, hash string) (bool, error)

func ParseRequestedImage

func ParseRequestedImage(s string) *requestedImage

func SaveToJson

func SaveToJson(file string, v interface{}) error

Types

type Client

type Client struct {
	*http.Client
	Image *requestedImage

	UA string
	// contains filtered or unexported fields
}

func (*Client) GetBlob

func (c *Client) GetBlob(tag digest.Digest, mediaTypeLayer string, resume int64) (*http.Response, error)

func (*Client) GetLayer

func (c *Client) GetLayer(dir string, diffId digest.Digest, layerDesc distribution.Descriptor, legacyImg image.V1Image, created time.Time) error

func (*Client) GetManifest

func (c *Client) GetManifest(tag string) (*schema2.Manifest, string, error)

func (*Client) GetManifestList

func (c *Client) GetManifestList() (*manifestlist.ManifestList, error)

func (*Client) NewGetRequest

func (c *Client) NewGetRequest(url string) (*http.Request, error)

func (*Client) SetCredentials

func (c *Client) SetCredentials(login, password string)

type RegistryClient

type RegistryClient struct {
	Arch     string
	OS       string
	Login    string
	Password string
	Insecure bool
}

func (*RegistryClient) Pull

func (rc *RegistryClient) Pull(imageReq *requestedImage) error

type WWWAuthenticate

type WWWAuthenticate struct {
	Realm, Service, Scope string
}

func WWWAuthenticateParse

func WWWAuthenticateParse(s string) (out WWWAuthenticate)

func (*WWWAuthenticate) Url

func (www *WWWAuthenticate) Url(action string) (string, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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