Documentation
¶
Index ¶
- type Client
- func (c *Client) ContainerAttach(ctx context.Context, id string, setters ...attach.SetContainerAttachOption) (*response.ContainerHijackedResponse, error)
- func (c *Client) ContainerCheckpointCreate(ctx context.Context, id string, ...) error
- func (c *Client) ContainerCheckpointDelete(ctx context.Context, id string, ...) error
- func (c *Client) ContainerCheckpointList(ctx context.Context, id string, ...) ([]response.ContainerCheckpointSummary, error)
- func (c *Client) ContainerCommit(ctx context.Context, id string, setters ...commit.SetContainerCommitOption) (*response.ContainerCommitResponse, error)
- func (c *Client) ContainerCopyFromContainer(ctx context.Context, id string, srcPath string) (io.ReadCloser, *response.ContainerPathStat, error)
- func (c *Client) ContainerCopyToContainer(ctx context.Context, id string, dstPath string, ...) error
- func (c *Client) ContainerCreate(ctx context.Context, created *create.Container) (*response.ContainerCreate, error)
- func (c *Client) ContainerDiff(ctx context.Context, id string) ([]response.ContainerFilesystemChange, error)
- func (c *Client) ContainerExecAttach(ctx context.Context, execID string, ...) (*response.ContainerHijackedResponse, error)
- func (c *Client) ContainerExecAttachTerminal(ctx context.Context, execID string, ...) (*terminal.Session, error)
- func (c *Client) ContainerExecCreate(ctx context.Context, containerID string, ...) (*response.ContainerExecCreate, error)
- func (c *Client) ContainerExecInspect(ctx context.Context, id string) (*response.ContainerExecInspect, error)
- func (c *Client) ContainerExecResize(ctx context.Context, execID string, ...) error
- func (c *Client) ContainerExecStart(ctx context.Context, execID string, ...) error
- func (c *Client) ContainerExport(ctx context.Context, id string) (io.ReadCloser, error)
- func (c *Client) ContainerInspect(ctx context.Context, id string) (*response.ContainerInspect, error)
- func (c *Client) ContainerKill(ctx context.Context, id string, signal string) error
- func (c *Client) ContainerList(ctx context.Context, setters ...list.SetContainerListOption) ([]response.ContainerSummary, error)
- func (c *Client) ContainerLogs(ctx context.Context, id string, setters ...logs.SetContainerLogsOption) (io.ReadCloser, error)
- func (c *Client) ContainerPause(ctx context.Context, id string) error
- func (c *Client) ContainerPrune(ctx context.Context, setters ...prune.SetContainerPruneOption) (*response.ContainerPruneReport, error)
- func (c *Client) ContainerRemove(ctx context.Context, id string, setters ...remove.SetContainerRemoveOption) error
- func (c *Client) ContainerRename(ctx context.Context, id string, name string) error
- func (c *Client) ContainerResize(ctx context.Context, id string, ...) error
- func (c *Client) ContainerRestart(ctx context.Context, id string, setters ...stop.SetContainerStopOption) error
- func (c *Client) ContainerStart(ctx context.Context, id string, setters ...start.SetContainerStartOption) error
- func (c *Client) ContainerStats(ctx context.Context, id string, stream bool) (*response.ContainerStatsReader, error)
- func (c *Client) ContainerStatsOneShot(ctx context.Context, id string) (*response.ContainerStatsOneShot, error)
- func (c *Client) ContainerStop(ctx context.Context, id string, setters ...stop.SetContainerStopOption) error
- func (c *Client) ContainerTop(ctx context.Context, id string, args ...string) (*response.ContainerTopResponse, error)
- func (c *Client) ContainerUnpause(ctx context.Context, id string) error
- func (c *Client) ContainerUpdate(ctx context.Context, id string, setters ...update.SetContainerUpdateOption) (*response.ContainerUpdateResponse, error)
- func (c *Client) ContainerWait(ctx context.Context, id string, condition wait.WaitCondition) (<-chan response.ContainerWait, <-chan error)
- func (c *Client) ContainerWaitSync(ctx context.Context, id string, condition wait.WaitCondition) error
- func (c *Client) ImageBuild(ctx context.Context, context io.Reader, setters ...build.SetImageBuildOption) (*response.ImageBuild, error)
- func (c *Client) ImageCreate(ctx context.Context, ref string, setters ...create.SetImageCreateOption) (io.ReadCloser, error)
- func (c *Client) ImageHistory(ctx context.Context, ref string) ([]response.ImageHistoryItem, error)
- func (c *Client) ImageImport(ctx context.Context, ref string, setters ...imports.SetImageImportOption) (io.ReadCloser, error)
- func (c *Client) ImageInspect(ctx context.Context, ref string) (*response.ImageInspect, error)
- func (c *Client) ImageList(ctx context.Context, setters ...list.SetImageListOption) ([]response.ImageSummary, error)
- func (c *Client) ImageLoad(ctx context.Context, setters ...load.SetImageLoadOption) (*response.ImageLoad, error)
- func (c *Client) ImagePull(ctx context.Context, ref string, setters ...pull.SetImagePullOption) (io.ReadCloser, error)
- func (c *Client) ImagePush(ctx context.Context, ref string) (io.ReadCloser, error)
- func (c *Client) ImageRemove(ctx context.Context, ref string, setters ...remove.SetImageRemoveOption) ([]response.ImageDelete, error)
- func (c *Client) ImageSave(ctx context.Context, setters ...save.SetImageSaveOption) (io.ReadCloser, error)
- func (c *Client) ImageSearch(ctx context.Context, term string, setters ...search.SetImageSearchOption) ([]response.ImageSearchResult, error)
- func (c *Client) ImageTag(ctx context.Context, source, target string) error
- func (c *Client) ImagesPrune(ctx context.Context, setters ...prune.SetImagePruneOption) (*response.PruneReport, error)
- func (c *Client) NetworkConnect(ctx context.Context, networkID string, ...) error
- func (c *Client) NetworkCreate(ctx context.Context, name string, setters ...create.SetNetworkCreateOption) (*response.NetworkCreate, error)
- func (c *Client) NetworkDisconnect(ctx context.Context, networkID string, containerID string, force bool) error
- func (c *Client) NetworkInspect(ctx context.Context, networkID string, ...) (*response.NetworkInspect, error)
- func (c *Client) NetworkList(ctx context.Context, setters ...list.SetNetworkListOption) ([]*response.NetworkSummary, error)
- func (c *Client) NetworkRemove(ctx context.Context, networkID string) error
- func (c *Client) NetworksPrune(ctx context.Context, setters ...prune.SetNetworkPruneOption) (*response.NetworkPruneReport, error)
- func (c *Client) SwarmInit(ctx context.Context, setters ...swarminit.SetSwarmInitOption) (token string, err error)
- func (c *Client) SwarmInspect(ctx context.Context) (*response.Swarm, error)
- func (c *Client) SwarmJoin(ctx context.Context, setters ...swarmjoin.SetSwarmJoinOption) error
- func (c *Client) SwarmLeave(ctx context.Context, force bool) error
- func (c *Client) Unwrap() *client.Client
- func (c *Client) VolumeCreate(ctx context.Context, setters ...create.SetVolumeCreateOption) (*response.Volume, error)
- func (c *Client) VolumeInspect(ctx context.Context, name string) (*response.Volume, error)
- func (c *Client) VolumeInspectWithRaw(ctx context.Context, name string) (*response.Volume, []byte, error)
- func (c *Client) VolumeList(ctx context.Context, setters ...list.SetVolumeListOption) (*response.VolumeList, error)
- func (c *Client) VolumeRemove(ctx context.Context, name string, force bool) error
- func (c *Client) VolumeUpdate(ctx context.Context, name string, swarmVersionIndex uint64, ...) error
- func (c *Client) VolumesPrune(ctx context.Context, setters ...prune.SetVolumePruneOption) (*response.VolumePruneReport, error)
- type LogCopier
- type SetClientOption
- func FromEnv() SetClientOption
- func WithAPIVersionNegotiation() SetClientOption
- func WithDialContext(dialContext func(ctx context.Context, network, addr string) (net.Conn, error)) SetClientOption
- func WithHTTPClient(httpClient *http.Client) SetClientOption
- func WithHTTPHeaders(headers map[string]string) SetClientOption
- func WithHost(host string) SetClientOption
- func WithHostFromEnv() SetClientOption
- func WithScheme(scheme string) SetClientOption
- func WithTLSClientConfig(cacertPath, certPath, keyPath string) SetClientOption
- func WithTLSClientConfigFromEnv() SetClientOption
- func WithTimeout(timeout time.Duration) SetClientOption
- func WithTraceOptions(opts ...otelhttp.Option) SetClientOption
- func WithTraceProvider(provider trace.TracerProvider) SetClientOption
- func WithUserAgent(userAgent string) SetClientOption
- func WithVersion(version string) SetClientOption
- func WithVersionFromEnv() SetClientOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a wrapper around the docker client.
func NewClient ¶
func NewClient(setters ...SetClientOption) (*Client, error)
func (*Client) ContainerAttach ¶
func (c *Client) ContainerAttach(ctx context.Context, id string, setters ...attach.SetContainerAttachOption) (*response.ContainerHijackedResponse, error)
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.
func (*Client) ContainerCheckpointCreate ¶
func (c *Client) ContainerCheckpointCreate(ctx context.Context, id string, setters ...checkpointcreate.SetContainerCheckpointCreateOption) error
ContainerCheckpointCreate creates a checkpoint of a running container.
func (*Client) ContainerCheckpointDelete ¶
func (c *Client) ContainerCheckpointDelete(ctx context.Context, id string, setters ...checkpointdelete.SetContainerCheckpointDeleteOption) error
CheckpointDelete deletes the checkpoint with the given name from the given container
func (*Client) ContainerCheckpointList ¶
func (c *Client) ContainerCheckpointList(ctx context.Context, id string, setters ...checkpointlist.SetContainerCheckpointListOption) ([]response.ContainerCheckpointSummary, error)
CheckpointList returns the checkpoints of the given container in the docker host
func (*Client) ContainerCommit ¶
func (c *Client) ContainerCommit(ctx context.Context, id string, setters ...commit.SetContainerCommitOption) (*response.ContainerCommitResponse, error)
ContainerCommit applies changes to a container and creates a new tagged image.
func (*Client) ContainerCopyFromContainer ¶
func (c *Client) ContainerCopyFromContainer(ctx context.Context, id string, srcPath string) (io.ReadCloser, *response.ContainerPathStat, error)
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.
func (*Client) ContainerCopyToContainer ¶
func (c *Client) ContainerCopyToContainer(ctx context.Context, id string, dstPath string, setters ...copyto.SetContainerCopyToContainerOption) error
CopyToContainer copies content into the container filesystem. Note that `content` must be a Reader for a TAR archive
func (*Client) ContainerCreate ¶
func (c *Client) ContainerCreate(ctx context.Context, created *create.Container) (*response.ContainerCreate, error)
ContainerCreate creates a new container based on the given configuration. It can be associated with a name, but it's not mandatory.
func (*Client) ContainerDiff ¶
func (c *Client) ContainerDiff(ctx context.Context, id string) ([]response.ContainerFilesystemChange, error)
ContainerDiff returns the changes on a container's filesystem.
func (*Client) ContainerExecAttach ¶
func (c *Client) ContainerExecAttach(ctx context.Context, execID string, setters ...execattach.SetContainerExecAttachOption) (*response.ContainerHijackedResponse, error)
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.
func (*Client) ContainerExecAttachTerminal ¶ added in v0.1.7
func (c *Client) ContainerExecAttachTerminal(ctx context.Context, execID string, setters ...execattach.SetContainerExecAttachOption) (*terminal.Session, error)
ContainerExecAttachTerminal attaches to a container exec command and returns a terminal session that can be used to interact with the command. The session handles terminal setup, raw mode, and cleanup automatically.
func (*Client) ContainerExecCreate ¶
func (c *Client) ContainerExecCreate(ctx context.Context, containerID string, setters ...execopt.SetContainerExecOption) (*response.ContainerExecCreate, error)
ContainerExecCreate creates a new exec configuration to run an exec process.
func (*Client) ContainerExecInspect ¶
func (c *Client) ContainerExecInspect(ctx context.Context, id string) (*response.ContainerExecInspect, error)
ContainerExecInspect returns information about a specific exec process on the docker host.
func (*Client) ContainerExecResize ¶
func (c *Client) ContainerExecResize(ctx context.Context, execID string, setters ...execresize.SetContainerExecResizeOption) error
ContainerExecResize changes the size of the tty for an exec process running inside a container.
func (*Client) ContainerExecStart ¶
func (c *Client) ContainerExecStart(ctx context.Context, execID string, setters ...execstart.SetContainerExecStartOption) error
ContainerExecStart starts an exec process already created in the docker host.
func (*Client) ContainerExport ¶
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.
func (*Client) ContainerInspect ¶
func (c *Client) ContainerInspect(ctx context.Context, id string) (*response.ContainerInspect, error)
ContainerInspect returns the container information.
func (*Client) ContainerKill ¶
ContainerKill terminates the container process but does not remove the container from the docker host.
func (*Client) ContainerList ¶
func (c *Client) ContainerList(ctx context.Context, setters ...list.SetContainerListOption) ([]response.ContainerSummary, error)
ContainerList returns the list of containers in the docker host.
func (*Client) ContainerLogs ¶
func (c *Client) ContainerLogs(ctx context.Context, id string, setters ...logs.SetContainerLogsOption) (io.ReadCloser, error)
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.
func (*Client) ContainerPause ¶
ContainerPause pauses the main process of a given container without terminating it
func (*Client) ContainerPrune ¶
func (c *Client) ContainerPrune(ctx context.Context, setters ...prune.SetContainerPruneOption) (*response.ContainerPruneReport, error)
ContainersPrune requests the daemon to delete unused data
func (*Client) ContainerRemove ¶
func (c *Client) ContainerRemove(ctx context.Context, id string, setters ...remove.SetContainerRemoveOption) error
ContainerRemove kills and removes a container from the docker host.
func (*Client) ContainerRename ¶
ContainerRename changes the name or nickname of a container.
func (*Client) ContainerResize ¶
func (c *Client) ContainerResize(ctx context.Context, id string, setters ...execresize.SetContainerExecResizeOption) error
ContainerResize changes the size of the tty for a container.
func (*Client) ContainerRestart ¶
func (c *Client) ContainerRestart(ctx context.Context, id string, setters ...stop.SetContainerStopOption) error
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.
func (*Client) ContainerStart ¶
func (c *Client) ContainerStart(ctx context.Context, id string, setters ...start.SetContainerStartOption) error
ContainerStart sends a request to the docker daemon to start a container.
func (*Client) ContainerStats ¶
func (c *Client) ContainerStats(ctx context.Context, id string, stream bool) (*response.ContainerStatsReader, error)
ContainerStats returns near realtime stats for a given container. It's up to the caller to close the io.ReadCloser returned.
func (*Client) ContainerStatsOneShot ¶
func (c *Client) ContainerStatsOneShot(ctx context.Context, id string) (*response.ContainerStatsOneShot, error)
ContainerStatsOneShot gets a single stat entry from a container. It differs from `ContainerStats` in that the API should not wait to prime the stats
func (*Client) ContainerStop ¶
func (c *Client) ContainerStop(ctx context.Context, id string, setters ...stop.SetContainerStopOption) error
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).
func (*Client) ContainerTop ¶
func (c *Client) ContainerTop(ctx context.Context, id string, args ...string) (*response.ContainerTopResponse, error)
ContainerTop shows process information from within a container.
func (*Client) ContainerUnpause ¶
ContainerUnpause resumes the process execution within a container
func (*Client) ContainerUpdate ¶
func (c *Client) ContainerUpdate(ctx context.Context, id string, setters ...update.SetContainerUpdateOption) (*response.ContainerUpdateResponse, error)
ContainerUpdate updates resources of a container.
func (*Client) ContainerWait ¶
func (c *Client) ContainerWait(ctx context.Context, id string, condition wait.WaitCondition) (<-chan response.ContainerWait, <-chan error)
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.
func (*Client) ContainerWaitSync ¶ added in v0.1.7
func (c *Client) ContainerWaitSync(ctx context.Context, id string, condition wait.WaitCondition) error
ContainerWaitSync blocks until the container reaches the desired state, an error occurs, or the context is cancelled.
Returns nil if the container completes successfully or if the context is cancelled, and returns a non-nil error only if the container fails or Docker reports an error.
func (*Client) ImageBuild ¶
func (c *Client) ImageBuild(ctx context.Context, context io.Reader, setters ...build.SetImageBuildOption) (*response.ImageBuild, error)
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.
func (*Client) ImageCreate ¶
func (c *Client) ImageCreate(ctx context.Context, ref string, setters ...create.SetImageCreateOption) (io.ReadCloser, error)
ImageCreate creates a new image based on the parent options. It returns the JSON content in the response body.
func (*Client) ImageHistory ¶
ImageHistory returns the changes in an image in history format.
func (*Client) ImageImport ¶
func (c *Client) ImageImport(ctx context.Context, ref string, setters ...imports.SetImageImportOption) (io.ReadCloser, error)
ImageImport creates a new image based on the source options. It returns the JSON content in the response body.
func (*Client) ImageInspect ¶
ImageInspect returns the image information.
func (*Client) ImageList ¶
func (c *Client) ImageList(ctx context.Context, setters ...list.SetImageListOption) ([]response.ImageSummary, error)
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.
func (*Client) ImageLoad ¶
func (c *Client) ImageLoad(ctx context.Context, setters ...load.SetImageLoadOption) (*response.ImageLoad, error)
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.
WithPlatform 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.
func (*Client) ImagePull ¶
func (c *Client) ImagePull(ctx context.Context, ref string, setters ...pull.SetImagePullOption) (io.ReadCloser, error)
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.
func (*Client) ImagePush ¶
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.
func (*Client) ImageRemove ¶
func (c *Client) ImageRemove(ctx context.Context, ref string, setters ...remove.SetImageRemoveOption) ([]response.ImageDelete, error)
ImageRemove removes an image from the docker host.
func (*Client) ImageSave ¶
func (c *Client) ImageSave(ctx context.Context, setters ...save.SetImageSaveOption) (io.ReadCloser, error)
ImageSave retrieves one or more images from the docker host as an io.ReadCloser.
func (*Client) ImageSearch ¶
func (c *Client) ImageSearch(ctx context.Context, term string, setters ...search.SetImageSearchOption) ([]response.ImageSearchResult, error)
ImageSearch makes the docker host search by a term in a remote registry. The list of results is not sorted in any fashion.
func (*Client) ImagesPrune ¶
func (c *Client) ImagesPrune(ctx context.Context, setters ...prune.SetImagePruneOption) (*response.PruneReport, error)
ImagesPrune requests the daemon to delete unused data
func (*Client) NetworkConnect ¶
func (c *Client) NetworkConnect(ctx context.Context, networkID string, setters ...connect.SetNetworkConnectOption) error
NetworkConnect connects a container to an existent network in the docker host.
func (*Client) NetworkCreate ¶
func (c *Client) NetworkCreate(ctx context.Context, name string, setters ...create.SetNetworkCreateOption) (*response.NetworkCreate, error)
NetworkCreate creates a new network in the docker host.
func (*Client) NetworkDisconnect ¶
func (c *Client) NetworkDisconnect(ctx context.Context, networkID string, containerID string, force bool) error
NetworkDisconnect disconnects a container from an existent network in the docker host.
func (*Client) NetworkInspect ¶
func (c *Client) NetworkInspect(ctx context.Context, networkID string, setters ...inspect.SetNetworkInspectOption) (*response.NetworkInspect, error)
NetworkInspect returns the information for a specific network configured in the docker host.
func (*Client) NetworkList ¶
func (c *Client) NetworkList(ctx context.Context, setters ...list.SetNetworkListOption) ([]*response.NetworkSummary, error)
NetworkList returns the list of networks configured in the docker host.
func (*Client) NetworkRemove ¶
NetworkRemove removes an existent network from the docker host.
func (*Client) NetworksPrune ¶
func (c *Client) NetworksPrune(ctx context.Context, setters ...prune.SetNetworkPruneOption) (*response.NetworkPruneReport, error)
NetworksPrune requests the daemon to delete unused networks
func (*Client) SwarmInit ¶ added in v0.1.7
func (c *Client) SwarmInit(ctx context.Context, setters ...swarminit.SetSwarmInitOption) (token string, err error)
SwarmInit initializes the swarm.
func (*Client) SwarmInspect ¶ added in v0.1.7
SwarmInspect inspects the swarm
func (*Client) SwarmLeave ¶ added in v0.1.7
SwarmLeave leaves the swarm
func (*Client) VolumeCreate ¶
func (c *Client) VolumeCreate(ctx context.Context, setters ...create.SetVolumeCreateOption) (*response.Volume, error)
VolumeCreate creates a volume in the docker host.
func (*Client) VolumeInspect ¶
VolumeInspect returns the information about a specific volume in the docker host.
func (*Client) VolumeInspectWithRaw ¶
func (c *Client) VolumeInspectWithRaw(ctx context.Context, name string) (*response.Volume, []byte, error)
VolumeInspectWithRaw returns the information about a specific volume in the docker host and its raw representation
func (*Client) VolumeList ¶
func (c *Client) VolumeList(ctx context.Context, setters ...list.SetVolumeListOption) (*response.VolumeList, error)
VolumeList returns the volumes configured in the docker host.
func (*Client) VolumeRemove ¶
VolumeRemove removes a volume from the docker host.
func (*Client) VolumeUpdate ¶
func (c *Client) VolumeUpdate(ctx context.Context, name string, swarmVersionIndex uint64, setters ...update.SetVolumeUpdateOption) error
VolumeUpdate updates a volume. This only works for Cluster Volumes, and only some fields can be updated.
func (*Client) VolumesPrune ¶
func (c *Client) VolumesPrune(ctx context.Context, setters ...prune.SetVolumePruneOption) (*response.VolumePruneReport, error)
VolumesPrune requests the daemon to delete unused data
type LogCopier ¶ added in v0.1.7
type LogCopier struct {
// contains filtered or unexported fields
}
LogCopier provides methods to copy Docker container logs
func NewLogCopier ¶ added in v0.1.7
NewLogCopier creates a new LogCopier instance for multiplexed streams If stderr is nil, it will use stdout for both streams
func (*LogCopier) Copy ¶ added in v0.1.7
Copy copies the container log stream to the configured writers It handles Docker's multiplexed output format where stdout and stderr are combined with headers
func (*LogCopier) CopyWithPrefix ¶ added in v0.1.7
func (lc *LogCopier) CopyWithPrefix(src io.Reader, stdoutPrefix, stderrPrefix string) (written int64, err error)
CopyWithPrefix copies the container log stream and adds prefixes to stdout and stderr This is useful when you want to distinguish between the two streams in the output
type SetClientOption ¶ added in v0.1.3
SetClientOption is a configuration option to initialize a Client.
func FromEnv ¶ added in v0.1.3
func FromEnv() SetClientOption
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:
- DOCKER_HOST ([EnvOverrideHost]) to set the URL to the docker server.
- DOCKER_API_VERSION ([EnvOverrideAPIVersion]) to set the version of the API to use, leave empty for latest.
- DOCKER_CERT_PATH ([EnvOverrideCertPath]) to specify the directory from which to load the TLS certificates ("ca.pem", "cert.pem", "key.pem').
- DOCKER_TLS_VERIFY ([EnvTLSVerify]) to enable or disable TLS verification (off by default).
func WithAPIVersionNegotiation ¶ added in v0.1.3
func WithAPIVersionNegotiation() SetClientOption
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.
func WithDialContext ¶ added in v0.1.3
func WithDialContext(dialContext func(ctx context.Context, network, addr string) (net.Conn, error)) SetClientOption
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.
func WithHTTPClient ¶ added in v0.1.3
func WithHTTPClient(httpClient *http.Client) SetClientOption
WithHTTPClient overrides the client's HTTP client with the specified one.
func WithHTTPHeaders ¶ added in v0.1.3
func WithHTTPHeaders(headers map[string]string) SetClientOption
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.
func WithHost ¶ added in v0.1.3
func WithHost(host string) SetClientOption
WithHost overrides the client host with the specified one.
func WithHostFromEnv ¶ added in v0.1.3
func WithHostFromEnv() SetClientOption
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.
func WithScheme ¶ added in v0.1.3
func WithScheme(scheme string) SetClientOption
WithScheme overrides the client scheme with the specified one.
func WithTLSClientConfig ¶ added in v0.1.3
func WithTLSClientConfig(cacertPath, certPath, keyPath string) SetClientOption
WithTLSClientConfig applies a TLS config to the client transport.
func WithTLSClientConfigFromEnv ¶ added in v0.1.3
func WithTLSClientConfigFromEnv() SetClientOption
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:
- DOCKER_CERT_PATH ([EnvOverrideCertPath]) to specify the directory from which to load the TLS certificates ("ca.pem", "cert.pem", "key.pem").
- DOCKER_TLS_VERIFY ([EnvTLSVerify]) to enable or disable TLS verification (off by default).
func WithTimeout ¶ added in v0.1.3
func WithTimeout(timeout time.Duration) SetClientOption
WithTimeout configures the time limit for requests made by the HTTP client.
func WithTraceOptions ¶ added in v0.1.3
func WithTraceOptions(opts ...otelhttp.Option) SetClientOption
WithTraceOptions sets tracing span options for the client.
func WithTraceProvider ¶ added in v0.1.3
func WithTraceProvider(provider trace.TracerProvider) SetClientOption
WithTraceProvider sets the trace provider for the client. If this is not set then the global trace provider will be used.
func WithUserAgent ¶ added in v0.1.3
func WithUserAgent(userAgent string) SetClientOption
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.
func WithVersion ¶ added in v0.1.3
func WithVersion(version string) SetClientOption
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 ¶ added in v0.1.3
func WithVersionFromEnv() SetClientOption
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.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
options
|
|
|
container/attach
package attach provides options for the container attach.
|
package attach provides options for the container attach. |
|
container/checkpointcreate
package checkpointcreate provides options for the container checkpoint create.
|
package checkpointcreate provides options for the container checkpoint create. |
|
container/checkpointdelete
package checkpointdelete provides options for the container checkpoint delete.
|
package checkpointdelete provides options for the container checkpoint delete. |
|
container/checkpointlist
package checkpointlist provides options for the container checkpoint list.
|
package checkpointlist provides options for the container checkpoint list. |
|
container/commit
package commit provides options for the container commit.
|
package commit provides options for the container commit. |
|
container/copyto
package copyto provides options for the container copy to container.
|
package copyto provides options for the container copy to container. |
|
container/execattach
package execattach provides options for the container exec attach.
|
package execattach provides options for the container exec attach. |
|
container/execopt
package execopt provides options for the container exec create.
|
package execopt provides options for the container exec create. |
|
container/execresize
package execresize provides options for the container exec resize.
|
package execresize provides options for the container exec resize. |
|
container/execstart
package execstart provides options for the container exec start.
|
package execstart provides options for the container exec start. |
|
container/list
Package list provides the options for the container list options
|
Package list provides the options for the container list options |
|
container/logs
package logs provides options for the container logs.
|
package logs provides options for the container logs. |
|
container/prune
package prune provides options for the container prune.
|
package prune provides options for the container prune. |
|
container/remove
Package remove provides the options for the container remove options
|
Package remove provides the options for the container remove options |
|
container/start
Package start provides the options for the container start options
|
Package start provides the options for the container start options |
|
container/stop
Package stop provides the options for the container stop options
|
Package stop provides the options for the container stop options |
|
container/update
package update provides options for the container update.
|
package update provides options for the container update. |
|
container/wait
Package wait provides options for container wait.
|
Package wait provides options for container wait. |
|
image/build
package build provides options for the image build.
|
package build provides options for the image build. |
|
image/create
package create provides options for the image create.
|
package create provides options for the image create. |
|
image/imports
Package imports provides options for image import.
|
Package imports provides options for image import. |
|
image/list
package list provides options for the image list.
|
package list provides options for the image list. |
|
image/load
Package load provides options for image load.
|
Package load provides options for image load. |
|
image/prune
Package prune provides options for image prune.
|
Package prune provides options for image prune. |
|
image/pull
package pull provides options for the image pull.
|
package pull provides options for the image pull. |
|
image/remove
Package remove provides options for image remove.
|
Package remove provides options for image remove. |
|
image/save
Package save provides options for image save.
|
Package save provides options for image save. |
|
image/search
Package search provides options for image search.
|
Package search provides options for image search. |
|
network/connect
package connect provides options for the network connect.
|
package connect provides options for the network connect. |
|
network/create
package create provides options for the network create.
|
package create provides options for the network create. |
|
network/create/ipam
package ipam provides options for the network IPAM.
|
package ipam provides options for the network IPAM. |
|
network/create/ipam/ipamconfig
package ipamconfig provides options for the network IPAM config.
|
package ipamconfig provides options for the network IPAM config. |
|
network/inspect
package inspect provides options for the network inspect.
|
package inspect provides options for the network inspect. |
|
network/list
package list provides options for the network list.
|
package list provides options for the network list. |
|
network/prune
package prune provides options for the network prune.
|
package prune provides options for the network prune. |
|
swarm/swarminit
Package swarminit provides options for the swarm init command.
|
Package swarminit provides options for the swarm init command. |
|
swarm/swarmjoin
Package swarmjoin provides options for the swarm join command.
|
Package swarmjoin provides options for the swarm join command. |
|
volume/create
package create provides options for the volume create.
|
package create provides options for the volume create. |
|
volume/create/clusterspec
package clusterspec provides options for the volume cluster volume spec.
|
package clusterspec provides options for the volume cluster volume spec. |
|
volume/create/clusterspec/accessibility
package accessibility provides options for the volume cluster volume spec accessibility requirements.
|
package accessibility provides options for the volume cluster volume spec accessibility requirements. |
|
volume/create/clusterspec/accessmode
package accessmode provides options for the volume cluster volume spec access mode.
|
package accessmode provides options for the volume cluster volume spec access mode. |
|
volume/list
Package list provides options for volume list operations.
|
Package list provides options for volume list operations. |
|
volume/prune
Package vpo provides options for volume prune operations.
|
Package vpo provides options for volume prune operations. |
|
volume/update
Package vuo provides options for volume update operations.
|
Package vuo provides options for volume update operations. |
|
Package response provides thin wrappers around the docker client response types.
|
Package response provides thin wrappers around the docker client response types. |