docker

package
v1.1.2-rc1 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2023 License: Apache-2.0 Imports: 38 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultCacheDuration = time.Hour
View Source
const DefaultCacheSize = uint64(1000)
View Source
const DistributionInspectError = `Could not inspect image %q - could be due to repo/image not existing, ` +
	`or registry needing authorization`
View Source
const ImagePullError = `Could not pull image %q - could be due to repo/image not existing, ` +
	`or registry needing authorization`

Variables

View Source
var DockerManifestCache cache.Cache[ImageManifest]
View Source
var DockerTagCache cache.Cache[string]

Functions

func EngineSpecRequiresDocker added in v1.0.4

func EngineSpecRequiresDocker(t testing.TB, engineSpec model.EngineSpec)

EngineSpecRequiresDocker will skip the test if the test is running in an environment that cannot support cross-platform Docker images, and the passed model.EngineSpec type is model.EngineDocker

func MaybeNeedDocker

func MaybeNeedDocker(t testing.TB, needDocker bool)

MaybeNeedDocker will skip the test if the test is running in an environment that cannot support cross-platform Docker images, and the passed boolean flag is true.

func MustHaveDocker

func MustHaveDocker(t testing.TB)

MustHaveDocker will skip the test if the test is running in an environment that cannot support cross-platform Docker images.

Types

type Client

type Client struct {
	tracing.TracedClient
}

func NewDockerClient

func NewDockerClient() (*Client, error)

func (*Client) FindContainer added in v0.3.25

func (c *Client) FindContainer(ctx context.Context, label string, value string) (string, error)

func (*Client) FollowLogs

func (c *Client) FollowLogs(ctx context.Context, id string) (stdout, stderr io.Reader, err error)

func (*Client) GetOutputStream added in v0.3.25

func (c *Client) GetOutputStream(ctx context.Context, id string, since string, follow bool) (io.ReadCloser, error)

func (*Client) HostGatewayIP

func (c *Client) HostGatewayIP(ctx context.Context) (net.IP, error)

func (*Client) ImageDistribution added in v1.0.1

func (c *Client) ImageDistribution(
	ctx context.Context, image string, creds config.DockerCredentials,
) (*ImageManifest, error)

ImageDistribution fetches the details for the specified image by asking docker to fetch the distribution manifest from the remote registry. This manifest will contain information on the digest along with the details of the platform that the image supports.

It is worth noting that if the call is made to the docker hub, the digest retrieved may not appear accurate when compared to the hub website but this is expected as the non-platform-specific digest is not displayed on the docker hub. This digest is safe however as both manual and programmatic pulls do the correct thing in retrieving the correct image for the platform.

cf:

When a docker image is available on only a single platform, the digest shown will be the digest pointing directly at the manifest for that image on that platform (as shown by the docker hub). Where multiple platforms are available, the digest is pointing to a top level document describing all of the different platform manifests available.

In either case, `docker pull` will do the correct thing and download the image for your platform. For example:

$ docker manifest inspect bitnami/rabbitmq@sha256:0be0d2a2 ...

"manifests": [ {
	  "digest": "sha256:959a02013e8ab5538167f9....",
	  "platform": { "architecture": "amd64", "os": "linux" }
	},
	{
	  "digest": "sha256:11ee2c7e9e69e3a8311a19....",
	  "platform": { "architecture": "arm64", "os": "linux"}
	}]

$ docker pull bitnami/rabbitmq@sha256:0be0d2a2 ... $ docker image ls bitnami/rabbitmq ... 48603925e10c

The digest 486039 can be found in manifest sha256:11ee2c7e which is the manifest for the current authors machine.

$ docker manifest inspect bitnami/rabbitmq@sha256:11ee2c7e

  "config": {
	   "size": 7383,
	   "digest": "sha256:48603925e10c01936ea4258f...."
  }

This is the image that will finally be installed.

func (*Client) ImagePlatforms added in v0.3.24

func (c *Client) ImagePlatforms(ctx context.Context, image string, dockerCreds config.DockerCredentials) ([]v1.Platform, error)

func (*Client) IsInstalled

func (c *Client) IsInstalled(ctx context.Context) bool

func (*Client) PullImage

func (c *Client) PullImage(ctx context.Context, image string, dockerCreds config.DockerCredentials) error

func (*Client) RemoveContainer

func (c *Client) RemoveContainer(ctx context.Context, id string) error

func (*Client) RemoveObjectsWithLabel

func (c *Client) RemoveObjectsWithLabel(ctx context.Context, labelName, labelValue string) error

func (*Client) SupportedPlatforms added in v0.3.24

func (c *Client) SupportedPlatforms(ctx context.Context) ([]v1.Platform, error)

type DigestTag added in v1.0.1

type DigestTag string

func (DigestTag) CacheDuration added in v1.0.1

func (DigestTag) CacheDuration() int64

func (DigestTag) Separator added in v1.0.1

func (DigestTag) Separator() string

func (DigestTag) String added in v1.0.1

func (n DigestTag) String() string

type EmptyTag added in v1.0.1

type EmptyTag struct{}

func (EmptyTag) CacheDuration added in v1.0.1

func (EmptyTag) CacheDuration() int64

func (EmptyTag) Separator added in v1.0.1

func (EmptyTag) Separator() string

func (EmptyTag) String added in v1.0.1

func (EmptyTag) String() string

type ImageID added in v1.0.1

type ImageID struct {
	// contains filtered or unexported fields
}

func NewImageID added in v1.0.1

func NewImageID(imageID string) (*ImageID, error)

func (*ImageID) HasDigest added in v1.0.1

func (i *ImageID) HasDigest() bool

func (*ImageID) String added in v1.0.1

func (i *ImageID) String() string

type ImageManifest added in v1.0.1

type ImageManifest struct {
	// We only ever expect the digest to be the `algorithm:hash`
	Digest    digest.Digest
	Platforms []v1.Platform
}

type ImageResolver added in v1.0.1

type ImageResolver struct {
	// contains filtered or unexported fields
}

func NewImageResolver added in v1.0.1

func NewImageResolver(orig *ImageID) *ImageResolver

func (*ImageResolver) Digest added in v1.0.1

func (r *ImageResolver) Digest() string

func (*ImageResolver) Resolve added in v1.0.1

func (r *ImageResolver) Resolve(ctx context.Context, resolver imageResolverFunc, tagCache cache.Cache[string]) error

type ImageTag added in v1.0.1

type ImageTag interface {
	CacheDuration() int64
	Separator() string
	String() string
}

func ParseImageTag added in v1.0.1

func ParseImageTag(s string) (string, ImageTag)

type NameTag added in v1.0.1

type NameTag string

func (NameTag) CacheDuration added in v1.0.1

func (n NameTag) CacheDuration() int64

func (NameTag) Separator added in v1.0.1

func (NameTag) Separator() string

func (NameTag) String added in v1.0.1

func (n NameTag) String() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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