A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://pkg.go.dev/github.com/docker/docker/client below:

client package - github.com/docker/docker/client - Go Packages

Package client is a Go client for the Docker Engine API.

For more information about the Engine API, see the documentation: https://docs.docker.com/reference/api/engine/

Usage ΒΆ

You use the library by constructing a client object using NewClientWithOpts and calling methods on it. The client can be configured from environment variables by passing the FromEnv option, or configured manually by passing any of the other available [Opts].

For example, to list running containers (the equivalent of "docker ps"):

package main

import (
	"context"
	"fmt"

	"github.com/docker/docker/api/types/container"
	"github.com/docker/docker/client"
)

func main() {
	cli, err := client.NewClientWithOpts(client.FromEnv)
	if err != nil {
		panic(err)
	}

	containers, err := cli.ContainerList(context.Background(), container.ListOptions{})
	if err != nil {
		panic(err)
	}

	for _, ctr := range containers {
		fmt.Printf("%s %s\n", ctr.ID, ctr.Image)
	}
}
View Source
const (
	
	
	
	
	
	
	EnvOverrideHost = "DOCKER_HOST"

	
	
	
	
	
	
	
	
	
	EnvOverrideAPIVersion = "DOCKER_API_VERSION"

	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	EnvOverrideCertPath = "DOCKER_CERT_PATH"

	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	EnvTLSVerify = "DOCKER_TLS_VERIFY"
)
View Source
const DefaultDockerHost = "unix:///var/run/docker.sock"

DefaultDockerHost defines OS-specific default host if the DOCKER_HOST (EnvOverrideHost) environment variable is unset or empty.

DummyHost is a hostname used for local communication.

It acts as a valid formatted hostname for local connections (such as "unix://" or "npipe://") which do not require a hostname. It should never be resolved, but uses the special-purpose ".localhost" TLD (as defined in RFC 2606, Section 2 and RFC 6761, Section 6.3).

RFC 7230, Section 5.4 defines that an empty header must be used for such cases:

If the authority component is missing or undefined for the target URI,
then a client MUST send a Host header field with an empty field-value.

However, Go stdlib enforces the semantics of HTTP(S) over TCP, does not allow an empty header to be used, and requires req.URL.Scheme to be either "http" or "https".

For further details, refer to:

ErrRedirect is the error returned by checkRedirect when the request is non-GET.

CheckRedirect specifies the policy for dealing with redirect responses. It can be set on http.Client.CheckRedirect to prevent HTTP redirects for non-GET requests. It returns an ErrRedirect for non-GET request, otherwise returns a http.ErrUseLastResponse, which is special-cased by http.Client to use the last response.

Go 1.8 changed behavior for HTTP redirects (specifically 301, 307, and 308) in the client. The client (and by extension API client) can be made to send a request like "POST /containers//start" where what would normally be in the name section of the URL is empty. This triggers an HTTP 301 from the daemon.

In go 1.8 this 301 is converted to a GET request, and ends up getting a 404 from the daemon. This behavior change manifests in the client in that before, the 301 was not followed and the client did not generate an error, but now results in a message like "Error response from daemon: page not found".

ErrorConnectionFailed returns an error with host in the error message when connection to docker daemon failed.

Deprecated: this function was only used internally, and will be removed in the next release.

FromEnv configures the client with values from environment variables. It is the equivalent of using the WithTLSClientConfigFromEnv, WithHostFromEnv, and WithVersionFromEnv options.

FromEnv uses the following environment variables:

IsErrConnectionFailed returns true if the error is caused by connection failed.

IsErrNotFound returns true if the error is a NotFound error, which is returned by the API when some object is not found. It is an alias for cerrdefs.IsNotFound.

Deprecated: use cerrdefs.IsNotFound instead.

ParseHostURL parses a url string, validates the string is a host url, and returns the parsed URL

APIClient is an interface that clients that talk with a docker server must implement.

CheckpointAPIClient defines API client methods for the checkpoints.

Experimental: checkpoint and restore is still an experimental feature, and only available if the daemon is running with experimental features enabled.

Client is the API client that performs all operations against a docker server.

NewClient initializes a new API client for the given host and API version. It uses the given http client as transport. It also initializes the custom http headers to add to each request.

It won't send any version information if the version number is empty. It is highly recommended that you set a version or your client may break if the server is upgraded.

Deprecated: use NewClientWithOpts passing the WithHost, WithVersion, WithHTTPClient and WithHTTPHeaders options. We recommend enabling API version negotiation by passing the WithAPIVersionNegotiation option instead of WithVersion.

NewClientWithOpts initializes a new API client with a default HTTPClient, and default API host and version. It also initializes the custom HTTP headers to add to each request.

It takes an optional list of Opt functional arguments, which are applied in the order they're provided, which allows modifying the defaults when creating the client. For example, the following initializes a client that configures itself with values from environment variables (FromEnv), and has automatic API version negotiation enabled (WithAPIVersionNegotiation).

cli, err := client.NewClientWithOpts(
	client.FromEnv,
	client.WithAPIVersionNegotiation(),
)

NewEnvClient initializes a new API client based on environment variables. See FromEnv for a list of support environment variables.

Deprecated: use NewClientWithOpts passing the FromEnv option.

BuildCachePrune requests the daemon to delete unused cache data

BuildCancel requests the daemon to cancel the ongoing build request.

CheckpointCreate creates a checkpoint from the given container with the given name

CheckpointDelete deletes the checkpoint with the given name from the given container

CheckpointList returns the checkpoints of the given container in the docker host

ClientVersion returns the API version used by this client.

Close the transport used by the client

ConfigCreate creates a new config.

ConfigInspectWithRaw returns the config information with raw data

ConfigList returns the list of configs.

ConfigRemove removes a config.

ConfigUpdate attempts to update a config

ContainerAttach attaches a connection to a container in the server. It returns a types.HijackedConnection with the hijacked connection and the a reader to get output. It's up to the called to close the hijacked connection by calling types.HijackedResponse.Close.

The stream format on the response will be in one of two formats:

If the container is using a TTY, there is only a single stream (stdout), and data is copied directly from the container output stream, no extra multiplexing or headers.

If the container is *not* using a TTY, streams for stdout and stderr are multiplexed. The format of the multiplexed stream is as follows:

[8]byte{STREAM_TYPE, 0, 0, 0, SIZE1, SIZE2, SIZE3, SIZE4}[]byte{OUTPUT}

STREAM_TYPE can be 1 for stdout and 2 for stderr

SIZE1, SIZE2, SIZE3, and SIZE4 are four bytes of uint32 encoded as big endian. This is the size of OUTPUT.

You can use github.com/docker/docker/pkg/stdcopy.StdCopy to demultiplex this stream.

ContainerCommit applies changes to a container and creates a new tagged image.

ContainerCreate creates a new container based on the given configuration. It can be associated with a name, but it's not mandatory.

ContainerDiff shows differences in a container filesystem since it was started.

ContainerExecAttach attaches a connection to an exec process in the server. It returns a types.HijackedConnection with the hijacked connection and the a reader to get output. It's up to the called to close the hijacked connection by calling types.HijackedResponse.Close.

ContainerExecCreate creates a new exec configuration to run an exec process.

ContainerExecInspect returns information about a specific exec process on the docker host.

ContainerExecResize changes the size of the tty for an exec process running inside a container.

ContainerExecStart starts an exec process already created in the docker host.

ContainerExport retrieves the raw contents of a container and returns them as an io.ReadCloser. It's up to the caller to close the stream.

ContainerInspect returns the container information.

ContainerInspectWithRaw returns the container information and its raw representation.

ContainerKill terminates the container process but does not remove the container from the docker host.

ContainerList returns the list of containers in the docker host.

ContainerLogs returns the logs generated by a container in an io.ReadCloser. It's up to the caller to close the stream.

The stream format on the response will be in one of two formats:

If the container is using a TTY, there is only a single stream (stdout), and data is copied directly from the container output stream, no extra multiplexing or headers.

If the container is *not* using a TTY, streams for stdout and stderr are multiplexed. The format of the multiplexed stream is as follows:

[8]byte{STREAM_TYPE, 0, 0, 0, SIZE1, SIZE2, SIZE3, SIZE4}[]byte{OUTPUT}

STREAM_TYPE can be 1 for stdout and 2 for stderr

SIZE1, SIZE2, SIZE3, and SIZE4 are four bytes of uint32 encoded as big endian. This is the size of OUTPUT.

You can use github.com/docker/docker/pkg/stdcopy.StdCopy to demultiplex this stream.

ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
defer cancel()

client, _ := NewClientWithOpts(FromEnv)
reader, err := client.ContainerLogs(ctx, "container_id", container.LogsOptions{})
if err != nil {
	log.Fatal(err)
}

_, err = io.Copy(os.Stdout, reader)
if err != nil && !errors.Is(err, io.EOF) {
	log.Fatal(err)
}

ContainerPause pauses the main process of a given container without terminating it.

ContainerRemove kills and removes a container from the docker host.

ContainerRename changes the name of a given container.

ContainerResize changes the size of the tty for a container.

ContainerRestart stops and starts a container again. It makes the daemon wait for the container to be up again for a specific amount of time, given the timeout.

ContainerStart sends a request to the docker daemon to start a container.

ContainerStatPath returns stat information about a path inside the container filesystem.

ContainerStats returns near realtime stats for a given container. It's up to the caller to close the io.ReadCloser returned.

ContainerStatsOneShot gets a single stat entry from a container. It differs from `ContainerStats` in that the API should not wait to prime the stats

ContainerStop stops a container. In case the container fails to stop gracefully within a time frame specified by the timeout argument, it is forcefully terminated (killed).

If the timeout is nil, the container's StopTimeout value is used, if set, otherwise the engine default. A negative timeout value can be specified, meaning no timeout, i.e. no forceful termination is performed.

ContainerTop shows process information from within a container.

ContainerUnpause resumes the process execution within a container

ContainerUpdate updates the resources of a container.

ContainerWait waits until the specified container is in a certain state indicated by the given condition, either "not-running" (default), "next-exit", or "removed".

If this client's API version is before 1.30, condition is ignored and ContainerWait will return immediately with the two channels, as the server will wait as if the condition were "not-running".

If this client's API version is at least 1.30, ContainerWait blocks until the request has been acknowledged by the server (with a response header), then returns two channels on which the caller can wait for the exit status of the container or an error if there was a problem either beginning the wait request or in getting the response. This allows the caller to synchronize ContainerWait with other calls, such as specifying a "next-exit" condition before issuing a ContainerStart request.

ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
defer cancel()

client, _ := NewClientWithOpts(FromEnv)
_, errC := client.ContainerWait(ctx, "container_id", "")
if err := <-errC; err != nil {
	log.Fatal(err)
}

ContainersPrune requests the daemon to delete unused data

CopyFromContainer gets the content from the container and returns it as a Reader for a TAR archive to manipulate it in the host. It's up to the caller to close the reader.

CopyToContainer copies content into the container filesystem. Note that `content` must be a Reader for a TAR archive

DaemonHost returns the host address used by the client

DialHijack returns a hijacked connection with negotiated protocol proto.

Dialer returns a dialer for a raw stream connection, with an HTTP/1.1 header, that can be used for proxying the daemon connection. It is used by "docker dial-stdio".

DiskUsage requests the current data usage from the daemon

DistributionInspect returns the image digest with the full manifest.

Events returns a stream of events in the daemon. It's up to the caller to close the stream by cancelling the context. Once the stream has been completely read an io.EOF error will be sent over the error channel. If an error is sent all processing will be stopped. It's up to the caller to reopen the stream in the event of an error by reinvoking this method.

HTTPClient returns a copy of the HTTP client bound to the server

ImageBuild sends a request to the daemon to build images. The Body in the response implements an io.ReadCloser and it's up to the caller to close it.

ImageCreate creates a new image based on the parent options. It returns the JSON content in the response body.

ImageHistory returns the changes in an image in history format.

ImageImport creates a new image based on the source options. It returns the JSON content in the response body.

ImageInspect returns the image information.

ImageList returns a list of images in the docker host.

Experimental: Setting the [options.Manifest] will populate image.Summary.Manifests with information about image manifests. This is experimental and might change in the future without any backward compatibility.

ImageLoad loads an image in the docker host from the client host. It's up to the caller to close the io.ReadCloser in the ImageLoadResponse returned by this function.

Platform is an optional parameter that specifies the platform to load from the provided multi-platform image. This is only has effect if the input image is a multi-platform image.

ImagePull requests the docker host to pull an image from a remote registry. It executes the privileged function if the operation is unauthorized and it tries one more time. It's up to the caller to handle the io.ReadCloser and close it properly.

FIXME(vdemeester): there is currently used in a few way in docker/docker - if not in trusted content, ref is used to pass the whole reference, and tag is empty - if in trusted content, ref is used to pass the reference name, and tag for the digest

ImagePush requests the docker host to push an image to a remote registry. It executes the privileged function if the operation is unauthorized and it tries one more time. It's up to the caller to handle the io.ReadCloser and close it properly.

ImageRemove removes an image from the docker host.

ImageSave retrieves one or more images from the docker host as an io.ReadCloser.

Platforms is an optional parameter that specifies the platforms to save from the image. This is only has effect if the input image is a multi-platform image.

ImageSearch makes the docker host search by a term in a remote registry. The list of results is not sorted in any fashion.

ImageTag tags an image in the docker host

ImagesPrune requests the daemon to delete unused data

Info returns information about the docker server.

NegotiateAPIVersion queries the API and updates the version to match the API version. NegotiateAPIVersion downgrades the client's API version to match the APIVersion if the ping version is lower than the default version. If the API version reported by the server is higher than the maximum version supported by the client, it uses the client's maximum version.

If a manual override is in place, either through the "DOCKER_API_VERSION" (EnvOverrideAPIVersion) environment variable, or if the client is initialized with a fixed version (WithVersion), no negotiation is performed.

If the API server's ping response does not contain an API version, or if the client did not get a successful ping response, it assumes it is connected with an old daemon that does not support API version negotiation, in which case it downgrades to the latest version of the API before version negotiation was added (1.24).

NegotiateAPIVersionPing downgrades the client's API version to match the APIVersion in the ping response. If the API version in pingResponse is higher than the maximum version supported by the client, it uses the client's maximum version.

If a manual override is in place, either through the "DOCKER_API_VERSION" (EnvOverrideAPIVersion) environment variable, or if the client is initialized with a fixed version (WithVersion), no negotiation is performed.

If the API server's ping response does not contain an API version, we assume we are connected with an old daemon without API version negotiation support, and downgrade to the latest version of the API before version negotiation was added (1.24).

NetworkConnect connects a container to an existent network in the docker host.

NetworkCreate creates a new network in the docker host.

NetworkDisconnect disconnects a container from an existent network in the docker host.

NetworkInspect returns the information for a specific network configured in the docker host.

NetworkInspectWithRaw returns the information for a specific network configured in the docker host and its raw representation.

NetworkList returns the list of networks configured in the docker host.

NetworkRemove removes an existent network from the docker host.

NetworksPrune requests the daemon to delete unused networks

NewVersionError returns an error if the APIVersion required is less than the current supported version.

It performs API-version negotiation if the Client is configured with this option, otherwise it assumes the latest API version is used.

NodeInspectWithRaw returns the node information.

NodeList returns the list of nodes.

NodeRemove removes a Node.

NodeUpdate updates a Node.

Ping pings the server and returns the value of the "Docker-Experimental", "Builder-Version", "OS-Type" & "API-Version" headers. It attempts to use a HEAD request on the endpoint, but falls back to GET if HEAD is not supported by the daemon. It ignores internal server errors returned by the API, which may be returned if the daemon is in an unhealthy state, but returns errors for other non-success status codes, failing to connect to the API, or failing to parse the API response.

PluginCreate creates a plugin

PluginDisable disables a plugin

PluginEnable enables a plugin

PluginInspectWithRaw inspects an existing plugin

PluginInstall installs a plugin

PluginList returns the installed plugins

PluginPush pushes a plugin to a registry

PluginRemove removes a plugin

PluginSet modifies settings for an existing plugin

PluginUpgrade upgrades a plugin

RegistryLogin authenticates the docker server with a given docker registry. It returns unauthorizedError when the authentication fails.

SecretCreate creates a new secret.

SecretInspectWithRaw returns the secret information with raw data

SecretList returns the list of secrets.

SecretRemove removes a secret.

SecretUpdate attempts to update a secret.

ServerVersion returns information of the docker client and server host.

ServiceCreate creates a new service.

ServiceInspectWithRaw returns the service information and the raw data.

ServiceList returns the list of services.

ServiceLogs returns the logs generated by a service in an io.ReadCloser. It's up to the caller to close the stream.

ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
defer cancel()

client, _ := NewClientWithOpts(FromEnv)
reader, err := client.ServiceLogs(ctx, "service_id", container.LogsOptions{})
if err != nil {
	log.Fatal(err)
}

_, err = io.Copy(os.Stdout, reader)
if err != nil && !errors.Is(err, io.EOF) {
	log.Fatal(err)
}

ServiceRemove kills and removes a service.

ServiceUpdate updates a Service. The version number is required to avoid conflicting writes. It should be the value as set *before* the update. You can find this value in the Meta field of swarm.Service, which can be found using ServiceInspectWithRaw.

SwarmGetUnlockKey retrieves the swarm's unlock key.

SwarmInit initializes the swarm.

SwarmInspect inspects the swarm.

SwarmJoin joins the swarm.

SwarmLeave leaves the swarm.

SwarmUnlock unlocks locked swarm.

SwarmUpdate updates the swarm.

TaskInspectWithRaw returns the task information and its raw representation.

TaskList returns the list of tasks.

TaskLogs returns the logs generated by a task in an io.ReadCloser. It's up to the caller to close the stream.

VolumeCreate creates a volume in the docker host.

VolumeInspect returns the information about a specific volume in the docker host.

VolumeInspectWithRaw returns the information about a specific volume in the docker host and its raw representation

VolumeList returns the volumes configured in the docker host.

VolumeRemove removes a volume from the docker host.

VolumeUpdate updates a volume. This only works for Cluster Volumes, and only some fields can be updated.

VolumesPrune requests the daemon to delete unused data

type CommonAPIClient = stableAPIClient

CommonAPIClient is the common methods between stable and experimental versions of APIClient.

Deprecated: use APIClient instead. This type will be an alias for APIClient in the next release, and removed after.

type ConfigAPIClient interface {
	ConfigList(ctx context.Context, options swarm.ConfigListOptions) ([]swarm.Config, error)
	ConfigCreate(ctx context.Context, config swarm.ConfigSpec) (swarm.ConfigCreateResponse, error)
	ConfigRemove(ctx context.Context, id string) error
	ConfigInspectWithRaw(ctx context.Context, name string) (swarm.Config, []byte, error)
	ConfigUpdate(ctx context.Context, id string, version swarm.Version, config swarm.ConfigSpec) error
}

ConfigAPIClient defines API client methods for configs

type ContainerAPIClient interface {
	ContainerAttach(ctx context.Context, container string, options container.AttachOptions) (types.HijackedResponse, error)
	ContainerCommit(ctx context.Context, container string, options container.CommitOptions) (container.CommitResponse, error)
	ContainerCreate(ctx context.Context, config *container.Config, hostConfig *container.HostConfig, networkingConfig *network.NetworkingConfig, platform *ocispec.Platform, containerName string) (container.CreateResponse, error)
	ContainerDiff(ctx context.Context, container string) ([]container.FilesystemChange, error)
	ContainerExecAttach(ctx context.Context, execID string, options container.ExecAttachOptions) (types.HijackedResponse, error)
	ContainerExecCreate(ctx context.Context, container string, options container.ExecOptions) (container.ExecCreateResponse, error)
	ContainerExecInspect(ctx context.Context, execID string) (container.ExecInspect, error)
	ContainerExecResize(ctx context.Context, execID string, options container.ResizeOptions) error
	ContainerExecStart(ctx context.Context, execID string, options container.ExecStartOptions) error
	ContainerExport(ctx context.Context, container string) (io.ReadCloser, error)
	ContainerInspect(ctx context.Context, container string) (container.InspectResponse, error)
	ContainerInspectWithRaw(ctx context.Context, container string, getSize bool) (container.InspectResponse, []byte, error)
	ContainerKill(ctx context.Context, container, signal string) error
	ContainerList(ctx context.Context, options container.ListOptions) ([]container.Summary, error)
	ContainerLogs(ctx context.Context, container string, options container.LogsOptions) (io.ReadCloser, error)
	ContainerPause(ctx context.Context, container string) error
	ContainerRemove(ctx context.Context, container string, options container.RemoveOptions) error
	ContainerRename(ctx context.Context, container, newContainerName string) error
	ContainerResize(ctx context.Context, container string, options container.ResizeOptions) error
	ContainerRestart(ctx context.Context, container string, options container.StopOptions) error
	ContainerStatPath(ctx context.Context, container, path string) (container.PathStat, error)
	ContainerStats(ctx context.Context, container string, stream bool) (container.StatsResponseReader, error)
	ContainerStatsOneShot(ctx context.Context, container string) (container.StatsResponseReader, error)
	ContainerStart(ctx context.Context, container string, options container.StartOptions) error
	ContainerStop(ctx context.Context, container string, options container.StopOptions) error
	ContainerTop(ctx context.Context, container string, arguments []string) (container.TopResponse, error)
	ContainerUnpause(ctx context.Context, container string) error
	ContainerUpdate(ctx context.Context, container string, updateConfig container.UpdateConfig) (container.UpdateResponse, error)
	ContainerWait(ctx context.Context, container string, condition container.WaitCondition) (<-chan container.WaitResponse, <-chan error)
	CopyFromContainer(ctx context.Context, container, srcPath string) (io.ReadCloser, container.PathStat, error)
	CopyToContainer(ctx context.Context, container, path string, content io.Reader, options container.CopyToContainerOptions) error
	ContainersPrune(ctx context.Context, pruneFilters filters.Args) (container.PruneReport, error)
}

ContainerAPIClient defines API client methods for the containers

DistributionAPIClient defines API client methods for the registry

HijackDialer defines methods for a hijack dialer.

type ImageAPIClient interface {
	ImageBuild(ctx context.Context, context io.Reader, options build.ImageBuildOptions) (build.ImageBuildResponse, error)
	BuildCachePrune(ctx context.Context, opts build.CachePruneOptions) (*build.CachePruneReport, error)
	BuildCancel(ctx context.Context, id string) error
	ImageCreate(ctx context.Context, parentReference string, options image.CreateOptions) (io.ReadCloser, error)
	ImageImport(ctx context.Context, source image.ImportSource, ref string, options image.ImportOptions) (io.ReadCloser, error)

	ImageList(ctx context.Context, options image.ListOptions) ([]image.Summary, error)
	ImagePull(ctx context.Context, ref string, options image.PullOptions) (io.ReadCloser, error)
	ImagePush(ctx context.Context, ref string, options image.PushOptions) (io.ReadCloser, error)
	ImageRemove(ctx context.Context, image string, options image.RemoveOptions) ([]image.DeleteResponse, error)
	ImageSearch(ctx context.Context, term string, options registry.SearchOptions) ([]registry.SearchResult, error)
	ImageTag(ctx context.Context, image, ref string) error
	ImagesPrune(ctx context.Context, pruneFilter filters.Args) (image.PruneReport, error)

	ImageInspect(ctx context.Context, image string, _ ...ImageInspectOption) (image.InspectResponse, error)
	ImageHistory(ctx context.Context, image string, _ ...ImageHistoryOption) ([]image.HistoryResponseItem, error)
	ImageLoad(ctx context.Context, input io.Reader, _ ...ImageLoadOption) (image.LoadResponse, error)
	ImageSave(ctx context.Context, images []string, _ ...ImageSaveOption) (io.ReadCloser, error)

	ImageAPIClientDeprecated
}

ImageAPIClient defines API client methods for the images

ImageAPIClientDeprecated defines deprecated methods of the ImageAPIClient.

type ImageHistoryOption interface {
	Apply(*imageHistoryOpts) error
}

ImageHistoryOption is a type representing functional options for the image history operation.

ImageHistoryWithPlatform sets the platform for the image history operation.

type ImageInspectOption interface {
	Apply(*imageInspectOpts) error
}

ImageInspectOption is a type representing functional options for the image inspect operation.

ImageInspectWithAPIOpts sets the API options for the image inspect operation.

ImageInspectWithManifests sets manifests API option for the image inspect operation. This option is only available for API version 1.48 and up. With this option set, the image inspect operation response will have the image.InspectResponse.Manifests field populated if the server is multi-platform capable.

ImageInspectWithPlatform sets platform API option for the image inspect operation. This option is only available for API version 1.49 and up. With this option set, the image inspect operation will return information for the specified platform variant of the multi-platform image.

ImageInspectWithRawResponse instructs the client to additionally store the raw inspect response in the provided buffer.

type ImageLoadOption interface {
	Apply(*imageLoadOpts) error
}

ImageLoadOption is a type representing functional options for the image load operation.

ImageLoadWithPlatforms sets the platforms to be loaded from the image.

ImageLoadWithQuiet sets the quiet option for the image load operation.

type ImageSaveOption interface {
	Apply(*imageSaveOpts) error
}

ImageSaveWithPlatforms sets the platforms to be saved from the image.

type NetworkAPIClient interface {
	NetworkConnect(ctx context.Context, network, container string, config *network.EndpointSettings) error
	NetworkCreate(ctx context.Context, name string, options network.CreateOptions) (network.CreateResponse, error)
	NetworkDisconnect(ctx context.Context, network, container string, force bool) error
	NetworkInspect(ctx context.Context, network string, options network.InspectOptions) (network.Inspect, error)
	NetworkInspectWithRaw(ctx context.Context, network string, options network.InspectOptions) (network.Inspect, []byte, error)
	NetworkList(ctx context.Context, options network.ListOptions) ([]network.Summary, error)
	NetworkRemove(ctx context.Context, network string) error
	NetworksPrune(ctx context.Context, pruneFilter filters.Args) (network.PruneReport, error)
}

NetworkAPIClient defines API client methods for the networks

type NodeAPIClient interface {
	NodeInspectWithRaw(ctx context.Context, nodeID string) (swarm.Node, []byte, error)
	NodeList(ctx context.Context, options swarm.NodeListOptions) ([]swarm.Node, error)
	NodeRemove(ctx context.Context, nodeID string, options swarm.NodeRemoveOptions) error
	NodeUpdate(ctx context.Context, nodeID string, version swarm.Version, node swarm.NodeSpec) error
}

NodeAPIClient defines API client methods for the nodes

Opt is a configuration option to initialize a Client.

func WithAPIVersionNegotiation() Opt

WithAPIVersionNegotiation enables automatic API version negotiation for the client. With this option enabled, the client automatically negotiates the API version to use when making requests. API version negotiation is performed on the first request; subsequent requests do not re-negotiate.

WithDialContext applies the dialer to the client transport. This can be used to set the Timeout and KeepAlive settings of the client. It returns an error if the client does not have a http.Transport configured.

WithHTTPClient overrides the client's HTTP client with the specified one.

WithHTTPHeaders appends custom HTTP headers to the client's default headers. It does not allow for built-in headers (such as "User-Agent", if set) to be overridden. Also see WithUserAgent.

WithHost overrides the client host with the specified one.

func WithHostFromEnv() Opt

WithHostFromEnv overrides the client host with the host specified in the DOCKER_HOST (EnvOverrideHost) environment variable. If DOCKER_HOST is not set, or set to an empty value, the host is not modified.

WithScheme overrides the client scheme with the specified one.

func WithTLSClientConfig(cacertPath, certPath, keyPath string) Opt

WithTLSClientConfig applies a TLS config to the client transport.

func WithTLSClientConfigFromEnv() Opt

WithTLSClientConfigFromEnv configures the client's TLS settings with the settings in the DOCKER_CERT_PATH (EnvOverrideCertPath) and DOCKER_TLS_VERIFY (EnvTLSVerify) environment variables. If DOCKER_CERT_PATH is not set or empty, TLS configuration is not modified.

WithTLSClientConfigFromEnv uses the following environment variables:

WithTimeout configures the time limit for requests made by the HTTP client.

WithTraceOptions sets tracing span options for the client.

WithTraceProvider sets the trace provider for the client. If this is not set then the global trace provider will be used.

WithUserAgent configures the User-Agent header to use for HTTP requests. It overrides any User-Agent set in headers. When set to an empty string, the User-Agent header is removed, and no header is sent.

WithVersion overrides the client version with the specified one. If an empty version is provided, the value is ignored to allow version negotiation (see WithAPIVersionNegotiation).

func WithVersionFromEnv() Opt

WithVersionFromEnv overrides the client version with the version specified in the DOCKER_API_VERSION (EnvOverrideAPIVersion) environment variable. If DOCKER_API_VERSION is not set, or set to an empty value, the version is not modified.

type PluginAPIClient interface {
	PluginList(ctx context.Context, filter filters.Args) (types.PluginsListResponse, error)
	PluginRemove(ctx context.Context, name string, options types.PluginRemoveOptions) error
	PluginEnable(ctx context.Context, name string, options types.PluginEnableOptions) error
	PluginDisable(ctx context.Context, name string, options types.PluginDisableOptions) error
	PluginInstall(ctx context.Context, name string, options types.PluginInstallOptions) (io.ReadCloser, error)
	PluginUpgrade(ctx context.Context, name string, options types.PluginInstallOptions) (io.ReadCloser, error)
	PluginPush(ctx context.Context, name string, registryAuth string) (io.ReadCloser, error)
	PluginSet(ctx context.Context, name string, args []string) error
	PluginInspectWithRaw(ctx context.Context, name string) (*types.Plugin, []byte, error)
	PluginCreate(ctx context.Context, createContext io.Reader, options types.PluginCreateOptions) error
}

PluginAPIClient defines API client methods for the plugins

type SecretAPIClient interface {
	SecretList(ctx context.Context, options swarm.SecretListOptions) ([]swarm.Secret, error)
	SecretCreate(ctx context.Context, secret swarm.SecretSpec) (swarm.SecretCreateResponse, error)
	SecretRemove(ctx context.Context, id string) error
	SecretInspectWithRaw(ctx context.Context, name string) (swarm.Secret, []byte, error)
	SecretUpdate(ctx context.Context, id string, version swarm.Version, secret swarm.SecretSpec) error
}

SecretAPIClient defines API client methods for secrets

type ServiceAPIClient interface {
	ServiceCreate(ctx context.Context, service swarm.ServiceSpec, options swarm.ServiceCreateOptions) (swarm.ServiceCreateResponse, error)
	ServiceInspectWithRaw(ctx context.Context, serviceID string, options swarm.ServiceInspectOptions) (swarm.Service, []byte, error)
	ServiceList(ctx context.Context, options swarm.ServiceListOptions) ([]swarm.Service, error)
	ServiceRemove(ctx context.Context, serviceID string) error
	ServiceUpdate(ctx context.Context, serviceID string, version swarm.Version, service swarm.ServiceSpec, options swarm.ServiceUpdateOptions) (swarm.ServiceUpdateResponse, error)
	ServiceLogs(ctx context.Context, serviceID string, options container.LogsOptions) (io.ReadCloser, error)
	TaskLogs(ctx context.Context, taskID string, options container.LogsOptions) (io.ReadCloser, error)
	TaskInspectWithRaw(ctx context.Context, taskID string) (swarm.Task, []byte, error)
	TaskList(ctx context.Context, options swarm.TaskListOptions) ([]swarm.Task, error)
}

ServiceAPIClient defines API client methods for the services

type SwarmAPIClient interface {
	SwarmInit(ctx context.Context, req swarm.InitRequest) (string, error)
	SwarmJoin(ctx context.Context, req swarm.JoinRequest) error
	SwarmGetUnlockKey(ctx context.Context) (swarm.UnlockKeyResponse, error)
	SwarmUnlock(ctx context.Context, req swarm.UnlockRequest) error
	SwarmLeave(ctx context.Context, force bool) error
	SwarmInspect(ctx context.Context) (swarm.Swarm, error)
	SwarmUpdate(ctx context.Context, version swarm.Version, swarm swarm.Spec, flags swarm.UpdateFlags) error
}

SwarmAPIClient defines API client methods for the swarm

SwarmManagementAPIClient defines all methods for managing Swarm-specific objects.

SystemAPIClient defines API client methods for the system

type VolumeAPIClient interface {
	VolumeCreate(ctx context.Context, options volume.CreateOptions) (volume.Volume, error)
	VolumeInspect(ctx context.Context, volumeID string) (volume.Volume, error)
	VolumeInspectWithRaw(ctx context.Context, volumeID string) (volume.Volume, []byte, error)
	VolumeList(ctx context.Context, options volume.ListOptions) (volume.ListResponse, error)
	VolumeRemove(ctx context.Context, volumeID string, force bool) error
	VolumesPrune(ctx context.Context, pruneFilter filters.Args) (volume.PruneReport, error)
	VolumeUpdate(ctx context.Context, volumeID string, version swarm.Version, options volume.UpdateOptions) error
}

VolumeAPIClient defines API client methods for the volumes


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4