### Exec Start Options Source: https://pkg.go.dev/github.com/moby/moby/client Options for starting a previously created container execution process. ```APIDOC ## ExecStartOptions ### Description Options used when starting a container exec process. ### Request Body - **Detach** (bool) - Optional - Whether to run in detached mode - **TTY** (bool) - Optional - Check if there's a tty - **ConsoleSize** (ConsoleSize) - Optional - Terminal size [height, width] ``` -------------------------------- ### Container Start Options Source: https://pkg.go.dev/github.com/moby/moby/client Options for starting a container. ```APIDOC ## ContainerStartOptions ### Description Holds options for Client.ContainerStart. ### Fields - **CheckpointID** (string) - The ID of the checkpoint to restore from. - **CheckpointDir** (string) - The directory containing the checkpoint. ``` -------------------------------- ### Define ExecStartOptions Source: https://pkg.go.dev/github.com/moby/moby/client Configuration for starting a container exec process. ```go type ExecStartOptions struct { // ExecStart will first check if it's detached Detach bool // Check if there's a tty TTY bool // Terminal size [height, width], unused if TTY == false ConsoleSize ConsoleSize } ``` -------------------------------- ### Exec Start API Source: https://pkg.go.dev/github.com/moby/moby/client API for starting a previously created execution. It takes an exec ID and options, returning a stream of the execution's output. ```APIDOC ## Exec Start API ### Description This API endpoint starts a previously created execution. It requires the `execID` and can accept `ExecStartOptions` to control aspects like TTY allocation. It returns an `ExecStartResult` which provides a stream of the execution's output (stdout and stderr). ### Method POST ### Endpoint `/exec/{id}/start` ### Parameters #### Path Parameters - **id** (string) - Required - The ID of the execution to start. #### Request Body - **Tty** (bool) - Optional - Whether to allocate a pseudo-TTY for the execution. If true, stdout and stderr are multiplexed. ### Request Example ```json { "Tty": true } ``` ### Response #### Success Response (200 OK) - **Output** (io.ReadCloser) - A readable stream containing the output of the execution. #### Response Example (The response is a stream of bytes representing the execution's output.) ``` -------------------------------- ### ExecStart API Source: https://pkg.go.dev/github.com/moby/moby/client Starts an exec process that has already been created on the Docker host. ```APIDOC ## POST /exec/{id}/start ### Description Starts an exec process already created in the Docker host. ### Method POST ### Endpoint /exec/{id}/start ### Parameters #### Path Parameters - **id** (string) - Required - The ID of the exec process to start. #### Query Parameters - **options** (ExecStartOptions) - Optional - Options for starting the exec process. ``` -------------------------------- ### List Running Docker Containers Source: https://pkg.go.dev/github.com/moby/moby/client This example demonstrates how to list only running containers. It uses `log.Fatal` for error handling and requires the client to be configured from environment variables. ```go package main import ( "context" "fmt" "log" "github.com/moby/moby/client" ) func main() { // Create a new client that handles common environment variables // for configuration (DOCKER_HOST, DOCKER_API_VERSION), and does // API-version negotiation to allow downgrading the API version // when connecting with an older daemon version. apiClient, err := client.New(client.FromEnv) if err != nil { log.Fatal(err) } // List all containers (both stopped and running). result, err := apiClient.ContainerList(context.Background(), client.ContainerListOptions{ All: true, }) if err != nil { log.Fatal(err) } // Print each container's ID, status and the image it was created from. fmt.Printf("%s %-22s %s\n", "ID", "STATUS", "IMAGE") for _, ctr := range result.Items { fmt.Printf("%s %-22s %s\n", ctr.ID, ctr.Status, ctr.Image) } } ``` -------------------------------- ### Diff container filesystem Source: https://pkg.go.dev/github.com/moby/moby/client Shows filesystem differences in a container since it was started. ```go func (cli *Client) ContainerDiff(ctx context.Context, containerID string, options ContainerDiffOptions) (ContainerDiffResult, error) ``` -------------------------------- ### Define ExecStartResult Source: https://pkg.go.dev/github.com/moby/moby/client Result structure for starting a container exec. ```go type ExecStartResult struct{} ``` -------------------------------- ### ParseTimestamps Usage Example Source: https://pkg.go.dev/github.com/moby/moby/client/internal/timestamp Example usage of ParseTimestamps to convert a string into seconds and nanoseconds for time.Unix. ```go seconds, nanoseconds, _ := ParseTimestamp("1136073600.000000001",0) since := time.Unix(seconds, nanoseconds) ``` -------------------------------- ### Exec Operations Source: https://pkg.go.dev/github.com/moby/moby/client APIs for executing commands in containers, including creating, starting, attaching, inspecting, and resizing. ```APIDOC ## POST /exec/{id}/attach ### Description Attach to an exec process. ### Method POST ### Endpoint /exec/{id}/attach ### Parameters #### Path Parameters - **id** (string) - Required - The ID of the exec process. #### Query Parameters - **detachKeys** (string) - Optional - Override the key sequence for detaching (e.g., "ctrl-p,ctrl-q"). ### Response #### Success Response (200 OK) - **stream** (io.Reader) - A stream of the exec process output. ## POST /exec/create ### Description Create an exec instance in a container. ### Method POST ### Endpoint /exec/create ### Parameters #### Request Body - **Container** (string) - Required - The ID of the container to run the command in. - **Command** ([]string) - Required - The command to run. - **AttachStdin** (bool) - Optional - Attach to stdin. - **AttachStdout** (bool) - Optional - Attach to stdout. - **AttachStderr** (bool) - Optional - Attach to stderr. - **Tty** (bool) - Optional - Allocate a pseudo-TTY. - **Env** ([]string) - Optional - Environment variables. - **WorkingDir** (string) - Optional - Working directory. - **User** (string) - Optional - User to run the command as. - **Privileged** (bool) - Optional - Give extended privileges to the command. - **Height** (uint) - Optional - Height of the TTY session in rows. - **Width** (uint) - Optional - Width of the TTY session in columns. ### Response #### Success Response (201 Created) - **ID** (string) - The ID of the created exec instance. ## GET /exec/{id}/inspect ### Description Return a list of system-wide events. ### Method GET ### Endpoint /exec/{id}/inspect ### Parameters #### Path Parameters - **id** (string) - Required - The ID of the exec process. ### Response #### Success Response (200 OK) - **ExecInspectResult** (ExecInspectResult) - Information about the exec process. ## POST /exec/{id}/resize ### Description Resize the TTY session of an exec process. ### Method POST ### Endpoint /exec/{id}/resize ### Parameters #### Path Parameters - **id** (string) - Required - The ID of the exec process. #### Query Parameters - **h** (uint) - Required - Height of the TTY session in rows. - **w** (uint) - Required - Width of the TTY session in columns. ### Response #### Success Response (200 OK) No content is returned on success. ## POST /exec/{id}/start ### Description Start a previously created exec process. ### Method POST ### Endpoint /exec/{id}/start ### Parameters #### Path Parameters - **id** (string) - Required - The ID of the exec process. #### Query Parameters - **detachKeys** (string) - Optional - Override the key sequence for detaching (e.g., "ctrl-p,ctrl-q"). ### Response #### Success Response (200 OK) - **stream** (io.Reader) - A stream of the exec process output. ``` -------------------------------- ### Get client API version Source: https://pkg.go.dev/github.com/moby/moby/client Returns the API version currently in use by the client. ```go func (cli *Client) ClientVersion() string ``` -------------------------------- ### Get MediaType Source: https://pkg.go.dev/github.com/moby/moby/client Determines if the stream is raw or multiplexed. ```go func (h *HijackedResponse) MediaType() (string, bool) ``` -------------------------------- ### Plugin Management API Source: https://pkg.go.dev/github.com/moby/moby/client Endpoints for inspecting, installing, listing, pushing, removing, setting, and upgrading Docker plugins. ```APIDOC ## PluginInspect ### Description Inspects an existing plugin. ### Parameters #### Path Parameters - **name** (string) - Required - The name of the plugin to inspect. ### Response - **PluginInspectResult** (object) - The details of the plugin. ``` ```APIDOC ## PluginInstall ### Description Installs a plugin. ### Parameters #### Path Parameters - **name** (string) - Required - The name of the plugin to install. ### Response - **PluginInstallResult** (object) - The result of the installation. ``` -------------------------------- ### List configurations Source: https://pkg.go.dev/github.com/moby/moby/client Returns a list of all available configurations. ```go func (cli *Client) ConfigList(ctx context.Context, options ConfigListOptions) (ConfigListResult, error) ``` -------------------------------- ### Create a configuration Source: https://pkg.go.dev/github.com/moby/moby/client Creates a new configuration object. ```go func (cli *Client) ConfigCreate(ctx context.Context, options ConfigCreateOptions) (ConfigCreateResult, error) ``` -------------------------------- ### Client Initialization Source: https://pkg.go.dev/github.com/moby/moby/client Methods for initializing and configuring the Docker client. ```APIDOC ## Client Initialization ### New Creates a new Docker client with optional configuration options. ### Method `func New(ops ...Opt) (*Client, error)` ### Endpoint N/A (Client-side library) ### Parameters - **ops** (*Opt) - Variadic options for client configuration. ### Request Example ```go client, err := client.New() if err != nil { // Handle error } ``` ### Response #### Success Response (200) - **Client** (*Client) - A Docker client instance. - **error** (error) - An error if initialization fails. ### NewClientWithOpts Creates a new Docker client with specified options. This method is deprecated. ### Method `func NewClientWithOpts(ops ...Opt) (*Client, error)` ### Endpoint N/A (Client-side library) ### Parameters - **ops** (*Opt) - Variadic options for client configuration. ### Request Example ```go client, err := client.NewClientWithOpts() if err != nil { // Handle error } ``` ### Response #### Success Response (200) - **Client** (*Client) - A Docker client instance. - **error** (error) - An error if initialization fails. ``` -------------------------------- ### Inspect a configuration Source: https://pkg.go.dev/github.com/moby/moby/client Retrieves configuration information including raw data. ```go func (cli *Client) ConfigInspect(ctx context.Context, id string, options ConfigInspectOptions) (ConfigInspectResult, error) ``` -------------------------------- ### CopyFromContainer API Source: https://pkg.go.dev/github.com/moby/moby/client Gets the content from the container and returns it as a TAR archive. ```APIDOC ## GET /containers/{id}/copy ### Description Gets the content from the container and returns it as a Reader for a TAR archive. ### Method GET ### Endpoint /containers/{id}/copy ### Parameters #### Path Parameters - **id** (string) - Required - The ID of the container #### Query Parameters - **path** (string) - Required - The path in the container to copy from ``` -------------------------------- ### Client Initialization Source: https://pkg.go.dev/github.com/moby/moby/client Initializes a new Docker API client. ```APIDOC ## New Client Initialization ### Description New 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. By default, 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. Use WithAPIVersion or WithAPIVersionFromEnv to configure the client with a fixed API version and disable API version negotiation. ### Example ```go cli, err := client.New(client.FromEnv) ``` ``` -------------------------------- ### Create a container Source: https://pkg.go.dev/github.com/moby/moby/client Creates a new container based on the provided configuration. ```go func (cli *Client) ContainerCreate(ctx context.Context, options ContainerCreateOptions) (ContainerCreateResult, error) ``` -------------------------------- ### Define ExecInspectOptions Source: https://pkg.go.dev/github.com/moby/moby/client Options for inspecting a container exec. ```go type ExecInspectOptions struct{} ``` -------------------------------- ### Configure TLS from Environment Source: https://pkg.go.dev/github.com/moby/moby/client Configures TLS settings using DOCKER_CERT_PATH and DOCKER_TLS_VERIFY environment variables. ```go func WithTLSClientConfigFromEnv() Opt ``` -------------------------------- ### Configure Client Version (Deprecated) Source: https://pkg.go.dev/github.com/moby/moby/client Overrides the client version. Use WithAPIVersion instead. ```go func WithVersion(version string) Opt ``` -------------------------------- ### Initialize New Docker Client Source: https://pkg.go.dev/github.com/moby/moby/client Initializes a new API client with default HTTPClient and API host/version. It accepts optional functional arguments to modify defaults. API version negotiation is automatic by default. ```go func New(ops ...Opt) (*Client, error) ``` ```go cli, err := client.New(client.FromEnv) ``` -------------------------------- ### FromEnv Function Signature Source: https://pkg.go.dev/github.com/moby/moby/client Configures the client using environment variables such as DOCKER_HOST, DOCKER_API_VERSION, DOCKER_CERT_PATH, and DOCKER_TLS_VERIFY. ```go func FromEnv(c *clientConfig) error ``` -------------------------------- ### Create Standard Progress Output Source: https://pkg.go.dev/github.com/moby/moby/client/pkg/streamformatter Initializes a progress.Output object compatible with progress.NewProgressReader. ```go func NewProgressOutput(out io.Writer) progress.Output ``` -------------------------------- ### Define SystemInfoResult struct Source: https://pkg.go.dev/github.com/moby/moby/client Contains system information. ```go type SystemInfoResult struct { Info system.Info } ``` -------------------------------- ### Client Configuration Options Source: https://pkg.go.dev/github.com/moby/moby/client Functional options for initializing and configuring the Moby client. ```go type Opt func(*clientConfig) error ``` ```go func WithAPIVersion(version string) Opt ``` ```go func WithAPIVersionFromEnv() Opt ``` ```go func WithAPIVersionNegotiation() Opt ``` ```go func WithDialContext(dialContext func(ctx context.Context, network, addr string) (net.Conn, error)) Opt ``` ```go func WithHTTPClient(client *http.Client) Opt ``` ```go func WithHTTPHeaders(headers map[string]string) Opt ``` ```go func WithHost(host string) Opt ``` ```go func WithHostFromEnv() Opt ``` ```go func WithResponseHook(h ResponseHook) Opt ``` -------------------------------- ### Inspect a container Source: https://pkg.go.dev/github.com/moby/moby/client Returns detailed information about a container. ```go func (cli *Client) ContainerInspect(ctx context.Context, containerID string, options ContainerInspectOptions) (ContainerInspectResult, error) ``` -------------------------------- ### Configure User-Agent Source: https://pkg.go.dev/github.com/moby/moby/client Sets the User-Agent header for HTTP requests; setting an empty string removes the header. ```go func WithUserAgent(ua string) Opt ``` -------------------------------- ### Define ImageBuildOptions struct Source: https://pkg.go.dev/github.com/moby/moby/client Holds the configuration parameters necessary to build images. ```go type ImageBuildOptions struct { Tags []string SuppressOutput bool RemoteContext string NoCache bool Remove bool ForceRemove bool PullParent bool Isolation container.Isolation CPUSetCPUs string CPUSetMems string CPUShares int64 CPUQuota int64 CPUPeriod int64 Memory int64 MemorySwap int64 CgroupParent string NetworkMode string ShmSize int64 Dockerfile string Ulimits []*container.Ulimit // BuildArgs needs to be a *string instead of just a string so that // we can tell the difference between "" (empty string) and no value // at all (nil). See the parsing of buildArgs in // api/server/router/build/build_routes.go for even more info. BuildArgs map[string]*string AuthConfigs map[string]registry.AuthConfig Context io.Reader Labels map[string]string // squash the resulting image's layers to the parent // preserves the original image and creates a new one from the parent with all // the changes applied to a single layer Squash bool // CacheFrom specifies images that are used for matching cache. Images // specified here do not need to have a valid parent chain to match cache. CacheFrom []string SecurityOpt []string ExtraHosts []string // List of extra hosts Target string SessionID string // Platforms selects the platforms to build the image for. Multiple platforms // can be provided if the daemon supports multi-platform builds. Platforms []ocispec.Platform // Version specifies the version of the underlying builder to use Version build.BuilderVersion // BuildID is an optional identifier that can be passed together with the // build request. The same identifier can be used to gracefully cancel the // build with the cancel request. BuildID string // Outputs defines configurations for exporting build results. Only supported // in BuildKit mode Outputs []ImageBuildOutput } ``` -------------------------------- ### Exec Create Configuration Source: https://pkg.go.dev/github.com/moby/moby/client Defines the configuration options for creating a new execution process within a container. ```APIDOC ## ExecCreateOptions ### Description Configuration options for the exec feature of Docker. ### Request Body - **User** (string) - Optional - User that will run the command - **Privileged** (bool) - Optional - Is the container in privileged mode - **TTY** (bool) - Optional - Attach standard streams to a tty - **ConsoleSize** (ConsoleSize) - Optional - Initial terminal size [height, width] - **AttachStdin** (bool) - Optional - Attach the standard input - **AttachStderr** (bool) - Optional - Attach the standard error - **AttachStdout** (bool) - Optional - Attach the standard output - **DetachKeys** (string) - Optional - Escape keys for detach - **Env** ([]string) - Optional - Environment variables - **WorkingDir** (string) - Optional - Working directory - **Cmd** ([]string) - Optional - Execution commands and args ``` -------------------------------- ### List All Docker Containers Source: https://pkg.go.dev/github.com/moby/moby/client Use this snippet to list all containers, including stopped ones. It requires creating a client from environment variables and handling potential errors. ```go package main import ( "context" "fmt" "github.com/moby/moby/client" ) func main() { // Create a new client that handles common environment variables // for configuration (DOCKER_HOST, DOCKER_API_VERSION), and does // API-version negotiation to allow downgrading the API version // when connecting with an older daemon version. apiClient, err := client.New(client.FromEnv) if err != nil { panic(err) } defer apiClient.Close() // List all containers (both stopped and running). result, err := apiClient.ContainerList(context.Background(), client.ContainerListOptions{ All: true, }) if err != nil { panic(err) } // Print each container's ID, status and the image it was created from. fmt.Printf("%s %-22s %s\n", "ID", "STATUS", "IMAGE") for _, ctr := range result.Items { fmt.Printf("%s %-22s %s\n", ctr.ID, ctr.Status, ctr.Image) } } ``` -------------------------------- ### Initialize HijackedResponse Source: https://pkg.go.dev/github.com/moby/moby/client Constructor for creating a new HijackedResponse. ```go func NewHijackedResponse(conn net.Conn, mediaType string) HijackedResponse ``` -------------------------------- ### Define SwarmInitOptions struct Source: https://pkg.go.dev/github.com/moby/moby/client Contains options for initializing a new swarm. ```go type SwarmInitOptions struct { ListenAddr string AdvertiseAddr string DataPathAddr string DataPathPort uint32 ForceNewCluster bool Spec swarm.Spec AutoLockManagers bool Availability swarm.NodeAvailability DefaultAddrPool []netip.Prefix SubnetSize uint32 } ``` -------------------------------- ### Define Checkpoint Create Options Structure Source: https://pkg.go.dev/github.com/moby/moby/client Holds parameters for creating a checkpoint from a container. ```go type CheckpointCreateOptions struct { CheckpointID string CheckpointDir string Exit bool } ``` -------------------------------- ### Define ExecResizeOptions Source: https://pkg.go.dev/github.com/moby/moby/client Options for resizing a container exec TTY. ```go type ExecResizeOptions ContainerResizeOptions ``` -------------------------------- ### ContainerCreateOptions Source: https://pkg.go.dev/github.com/moby/moby/client Options for creating a container. ```APIDOC ## POST /containers/create ### Description Creates a new container based on the provided options. ### Method POST ### Endpoint /containers/create ### Parameters #### Request Body - **Config** (*container.Config) - Optional - Configuration for the container. - **HostConfig** (*container.HostConfig) - Optional - Host-specific configuration for the container. - **NetworkingConfig** (*network.NetworkingConfig) - Optional - Networking configuration for the container. - **Platform** (*ocispec.Platform) - Optional - Platform for the container. - **Name** (string) - Optional - Name to assign to the container. - **Image** (string) - Optional - Name of the image to use for the container. This is a shortcut for `Config.Image`. ### Request Example ```json { "Image": "ubuntu:latest", "Cmd": ["echo", "hello world"] } ``` ### Response #### Success Response (201 Created) - **ID** (string) - The ID of the created container. #### Response Example ```json { "ID": "a1b2c3d4e5f678901234567890abcdef1234567890abcdef1234567890abcdef" } ``` ``` -------------------------------- ### Create JSON Progress Output Source: https://pkg.go.dev/github.com/moby/moby/client/pkg/streamformatter Initializes a progress.Output that formats data as JSON objects. ```go func NewJSONProgressOutput(out io.Writer, newLines bool) progress.Output ``` -------------------------------- ### Configure Trace Provider Source: https://pkg.go.dev/github.com/moby/moby/client Sets the trace provider for the client, defaulting to the global provider if not set. ```go func WithTraceProvider(provider trace.TracerProvider) Opt ``` -------------------------------- ### Platform Information Structure Source: https://pkg.go.dev/github.com/moby/moby/client Holds information about the product name of the server platform. ```go type PlatformInfo struct { // Name is the name of the platform (for example, "Docker Engine - Community", // or "Docker Desktop 4.49.0 (208003)") Name string } ``` -------------------------------- ### Create a container checkpoint Source: https://pkg.go.dev/github.com/moby/moby/client Creates a checkpoint from the specified container. ```go func (cli *Client) CheckpointCreate(ctx context.Context, containerID string, options CheckpointCreateOptions) (CheckpointCreateResult, error) ``` -------------------------------- ### Configure Client Scheme Source: https://pkg.go.dev/github.com/moby/moby/client Overrides the client scheme with the specified string. ```go func WithScheme(scheme string) Opt ``` -------------------------------- ### Configure TLS Client Source: https://pkg.go.dev/github.com/moby/moby/client Applies a TLS configuration to the client transport using provided file paths. ```go func WithTLSClientConfig(cacertPath, certPath, keyPath string) Opt ``` -------------------------------- ### Configure Tracing Options Source: https://pkg.go.dev/github.com/moby/moby/client Sets tracing span options for the client. ```go func WithTraceOptions(opts ...otelhttp.Option) Opt ``` -------------------------------- ### Define ContainerCreateOptions for Docker API Source: https://pkg.go.dev/github.com/moby/moby/client Holds parameters for creating a container. Configure container, host, networking, platform, and name. Image can be specified directly or via Config. ```go type ContainerCreateOptions struct { Config *container.Config HostConfig *container.HostConfig NetworkingConfig *network.NetworkingConfig Platform *ocispec.Platform Name string // Image is a shortcut for Config.Image - only one of Image or Config.Image should be set. Image string } ``` -------------------------------- ### Define ExecCreateOptions Source: https://pkg.go.dev/github.com/moby/moby/client Configuration parameters for creating a container exec process. ```go type ExecCreateOptions struct { User string // User that will run the command Privileged bool // Is the container in privileged mode TTY bool // Attach standard streams to a tty. ConsoleSize ConsoleSize // Initial terminal size [height, width], unused if TTY == false AttachStdin bool // Attach the standard input, makes possible user interaction AttachStderr bool // Attach the standard error AttachStdout bool // Attach the standard output DetachKeys string // Escape keys for detach Env []string // Environment variables WorkingDir string // Working directory Cmd []string // Execution commands and args } ``` -------------------------------- ### ServerVersionOptions Source: https://pkg.go.dev/github.com/moby/moby/client Options for retrieving server version information. ```APIDOC ## ServerVersionOptions ### Description Specifies options for the server version request. ``` -------------------------------- ### Define Build Cancel Options Structure Source: https://pkg.go.dev/github.com/moby/moby/client An empty structure for build cancel options. ```go type BuildCancelOptions struct{} ``` -------------------------------- ### Define ExecAttachOptions Source: https://pkg.go.dev/github.com/moby/moby/client Configuration for attaching to a container exec process. ```go type ExecAttachOptions struct { // Check if there's a tty TTY bool // Terminal size [height, width], unused if TTY == false ConsoleSize ConsoleSize `json:",omitzero"` } ``` -------------------------------- ### Define ImageBuildOutput struct Source: https://pkg.go.dev/github.com/moby/moby/client Defines configuration for exporting a build result. ```go type ImageBuildOutput struct { Type string Attrs map[string]string } ``` -------------------------------- ### Configure Version from Environment (Deprecated) Source: https://pkg.go.dev/github.com/moby/moby/client Overrides the client version using the DOCKER_API_VERSION environment variable. Use WithAPIVersionFromEnv instead. ```go func WithVersionFromEnv() Opt ``` -------------------------------- ### ContainerTop API Source: https://pkg.go.dev/github.com/moby/moby/client Shows process information from within a container. ```APIDOC ## POST /containers/{id}/top ### Description Shows process information from within a container. ### Method POST ### Endpoint /containers/{id}/top ### Parameters #### Path Parameters - **id** (string) - Required - The ID of the container #### Query Parameters - **ps_args** (string) - Optional - The arguments to pass to ps ``` -------------------------------- ### Service Creation Source: https://pkg.go.dev/github.com/moby/moby/client Provides methods to create new services with specified options. ```APIDOC ## POST /services ### Description Creates a new service with the specified configuration. ### Method POST ### Endpoint /services ### Parameters #### Request Body - **Spec** (swarm.ServiceSpec) - Required - The specification for the service. - **EncodedRegistryAuth** (string) - Optional - Encoded registry authorization credentials. - **QueryRegistry** (bool) - Optional - Whether to query the registry for image details. ### Request Example ```json { "Spec": { ... }, "EncodedRegistryAuth": "...", "QueryRegistry": true } ``` ### Response #### Success Response (200) - **ID** (string) - The ID of the created service. - **Warnings** ([]string) - A list of warnings that occurred during service creation. #### Response Example ```json { "ID": "service_id_123", "Warnings": ["Warning message"] } ``` ``` -------------------------------- ### Update a configuration Source: https://pkg.go.dev/github.com/moby/moby/client Attempts to update an existing configuration. ```go func (cli *Client) ConfigUpdate(ctx context.Context, id string, options ConfigUpdateOptions) (ConfigUpdateResult, error) ``` -------------------------------- ### Define ConfigUpdateOptions for Docker API Source: https://pkg.go.dev/github.com/moby/moby/client Holds options for updating a configuration, including its version and specification. ```go type ConfigUpdateOptions struct { Version swarm.Version Spec swarm.ConfigSpec } ``` -------------------------------- ### Define Option structure Source: https://pkg.go.dev/github.com/moby/moby/client/pkg/security Contains the name and associated key-value options for a security configuration. ```go type Option struct { Name string Options []KeyValue } ``` -------------------------------- ### Remove a configuration Source: https://pkg.go.dev/github.com/moby/moby/client Deletes an existing configuration. ```go func (cli *Client) ConfigRemove(ctx context.Context, id string, options ConfigRemoveOptions) (ConfigRemoveResult, error) ``` -------------------------------- ### Define Network creation structures Source: https://pkg.go.dev/github.com/moby/moby/client Structures for configuring and receiving results from network creation operations. ```go type NetworkCreateOptions struct { Driver string // Driver is the driver-name used to create the network (e.g. `bridge`, `overlay`) Scope string // Scope describes the level at which the network exists (e.g. `swarm` for cluster-wide or `local` for machine level). EnableIPv4 *bool // EnableIPv4 represents whether to enable IPv4. EnableIPv6 *bool // EnableIPv6 represents whether to enable IPv6. IPAM *network.IPAM // IPAM is the network's IP Address Management. Internal bool // Internal represents if the network is used internal only. Attachable bool // Attachable represents if the global scope is manually attachable by regular containers from workers in swarm mode. Ingress bool // Ingress indicates the network is providing the routing-mesh for the swarm cluster. ConfigOnly bool // ConfigOnly creates a config-only network. Config-only networks are place-holder networks for network configurations to be used by other networks. ConfigOnly networks cannot be used directly to run containers or services. ConfigFrom string // ConfigFrom specifies the source which will provide the configuration for this network. The specified network must be a config-only network; see [CreateOptions.ConfigOnly]. Options map[string]string // Options specifies the network-specific options to use for when creating the network. Labels map[string]string // Labels holds metadata specific to the network being created. } ``` ```go type NetworkCreateResult struct { ID string Warning []string } ``` -------------------------------- ### Container List Options Source: https://pkg.go.dev/github.com/moby/moby/client Options for listing containers. ```APIDOC ## Container List Options ### Description ContainerListOptions holds parameters to list containers with. ### Type Definition ```go type ContainerListOptions struct { Size bool All bool Limit int Filters Filters // Latest is non-functional and should not be used. Use Limit: 1 instead. // // Deprecated: the Latest option is non-functional and should not be used. Use Limit: 1 instead. Latest bool // Since is no longer supported. Use the "since" filter instead. // // Deprecated: the Since option is no longer supported since docker 1.12 (API 1.24). Use the "since" filter instead. Since string // Before is no longer supported. Use the "since" filter instead. // // Deprecated: the Before option is no longer supported since docker 1.12 (API 1.24). Use the "before" filter instead. Before string } ``` ``` -------------------------------- ### Define Checkpoint List Options Structure Source: https://pkg.go.dev/github.com/moby/moby/client Holds parameters for listing checkpoints for a container. ```go type CheckpointListOptions struct { CheckpointDir string } ``` -------------------------------- ### System Information Source: https://pkg.go.dev/github.com/moby/moby/client APIs for retrieving daemon host information and system-wide disk usage. ```APIDOC ## GET /_ping ### Description Returns the daemon host name. ### Method GET ### Endpoint /_ping ## GET /system/df ### Description Returns system-wide disk usage information. ### Method GET ### Endpoint /system/df ### Parameters #### Query Parameters - **filters** (string) - Optional - A JSON encoded value of the filters to process on the list of containers, objects that match the filters are returned. ### Response #### Success Response (200 OK) - **Data** (DiskUsageResult) - Disk usage information. ``` -------------------------------- ### ConfigUpdateOptions Source: https://pkg.go.dev/github.com/moby/moby/client Options for updating a configuration. ```APIDOC ## POST /configs/{id}/update ### Description Updates an existing configuration. ### Method POST ### Endpoint /configs/{id}/update ### Parameters #### Path Parameters - **id** (string) - Required - The ID of the configuration to update. #### Request Body - **Version** (swarm.Version) - Required - The version of the configuration to update. - **Spec** (swarm.ConfigSpec) - Required - The new specification for the configuration. ### Request Example ```json { "Version": { "Index": 1 }, "Spec": { "Name": "my-config", "Data": "Y29uZmlnIGRhdGE=", "Labels": { "com.example.label": "value" } } } ``` ### Response #### Success Response (200 OK) (No content is returned on successful update) #### Error Response (404 Not Found) - **Error** (string) - Error message if the configuration is not found. ``` -------------------------------- ### Container Resize Options Source: https://pkg.go.dev/github.com/moby/moby/client Options for resizing a container's TTY. ```APIDOC ## ContainerResizeOptions ### Description Holds parameters to resize a TTY. It can be used to resize container TTYs and exec process TTYs too. ### Fields - **Height** (uint) - The new height of the TTY. - **Width** (uint) - The new width of the TTY. ``` -------------------------------- ### Container Diff Options Source: https://pkg.go.dev/github.com/moby/moby/client Options for showing differences in a container's filesystem. ```APIDOC ## Container Diff Options ### Description ContainerDiffOptions holds parameters to show differences in a container filesystem. ### Type Definition ```go type ContainerDiffOptions struct { } ``` ``` -------------------------------- ### Container Restart Options Source: https://pkg.go.dev/github.com/moby/moby/client Options for restarting a container. ```APIDOC ## ContainerRestartOptions ### Description Holds options for Client.ContainerRestart. ### Fields - **Signal** (string, optional) - The signal to send to the container to gracefully stop it before forcibly terminating with SIGKILL. Defaults to SIGTERM. - **Timeout** (*int, optional) - The timeout in seconds to wait for graceful shutdown. Use nil for default (10s), -1 for indefinite, 0 to not wait. ``` -------------------------------- ### ServerVersionResult Source: https://pkg.go.dev/github.com/moby/moby/client Contains information about the Docker server host. ```APIDOC ## ServerVersionResult ### Description Contains information about the Docker server host. ### Fields - **Platform** (PlatformInfo) - Information about the platform the server is running on. - **Version** (string) - The version of the daemon. - **APIVersion** (string) - The highest API version supported by the server. - **MinAPIVersion** (string) - The minimum API version the server supports. - **Os** (string) - The operating system the server runs on. - **Arch** (string) - The hardware architecture the server runs on. - **Experimental** (bool) - Indicates if experimental features are enabled (Deprecated). - **Components** ([]system.ComponentVersion) - Version information for server components. ``` -------------------------------- ### Define Checkpoint Create Result Structure Source: https://pkg.go.dev/github.com/moby/moby/client Holds the result from the client.CheckpointCreate method. ```go type CheckpointCreateResult struct { } ``` -------------------------------- ### ImageLoadWithPlatforms Function Source: https://pkg.go.dev/github.com/moby/moby/client ImageLoadWithPlatforms sets the platforms to be loaded from the image. This is an optional parameter that specifies the platform to load from the provided multi-platform image. Passing a platform only has an effect if the input image is a multi-platform image. ```go func ImageLoadWithPlatforms(platforms ...ocispec.Platform) ImageLoadOption ``` -------------------------------- ### Exec Create API Source: https://pkg.go.dev/github.com/moby/moby/client API for creating an execution of a command in a running container. It takes container ID and execution options, returning an exec ID. ```APIDOC ## Exec Create API ### Description This API endpoint creates an execution of a command inside a running container. It requires the container ID and `ExecCreateOptions` which specify the command to run and other execution parameters. It returns an `ExecCreateResult` containing the ID of the created execution. ### Method POST ### Endpoint `/containers/{id}/exec` ### Parameters #### Path Parameters - **id** (string) - Required - The ID of the container to execute the command in. #### Request Body - **AttachStdin** (bool) - Optional - Whether to attach to stdin. - **AttachStdout** (bool) - Optional - Whether to attach to stdout. - **AttachStderr** (bool) - Optional - Whether to attach to stderr. - **Tty** (bool) - Optional - Whether to allocate a pseudo-TTY. - **Cmd** ([]string) - Required - The command to execute (e.g., `["ls", "-l"]`). - **Env** ([]string) - Optional - A list of environment variables to set for the command. - **WorkingDir** (string) - Optional - The working directory for the command. ### Request Example ```json { "AttachStdin": false, "AttachStdout": true, "AttachStderr": true, "Tty": false, "Cmd": ["echo", "hello"] } ``` ### Response #### Success Response (201 Created) - **ID** (string) - The ID of the created execution. #### Response Example ```json { "ID": "exec_id_12345" } ``` ``` -------------------------------- ### Image Build API Source: https://pkg.go.dev/github.com/moby/moby/client Methods for building container images and managing build resources. ```APIDOC ## Image Build Operations ### Description Provides methods to build images from a context and manage build-related resources. ### Methods - ImageBuild: Builds an image from a provided context (io.Reader) and options. - BuildCachePrune: Prunes the build cache. - BuildCancel: Cancels an ongoing build by ID. ``` -------------------------------- ### Configuration Management API Source: https://pkg.go.dev/github.com/moby/moby/client APIs for creating, inspecting, listing, removing, and updating configurations. ```APIDOC ## POST /configs/create ### Description Creates a new config. ### Method POST ### Endpoint /configs/create ### Parameters #### Request Body - **options** (ConfigCreateOptions) - Required - Options for creating the config. ``` ```APIDOC ## GET /configs/{id} ### Description Returns the config information with raw data. ### Method GET ### Endpoint /configs/{id} ### Parameters #### Path Parameters - **id** (string) - Required - The ID of the config. #### Query Parameters - **options** (ConfigInspectOptions) - Optional - Options for inspecting the config. ``` ```APIDOC ## GET /configs ### Description Returns the list of configs. ### Method GET ### Endpoint /configs ### Parameters #### Query Parameters - **options** (ConfigListOptions) - Optional - Options for listing configs. ``` ```APIDOC ## DELETE /configs/{id} ### Description Removes a config. ### Method DELETE ### Endpoint /configs/{id} ### Parameters #### Path Parameters - **id** (string) - Required - The ID of the config. #### Query Parameters - **options** (ConfigRemoveOptions) - Optional - Options for removing the config. ``` ```APIDOC ## POST /configs/{id}/update ### Description Attempts to update a config. ### Method POST ### Endpoint /configs/{id}/update ### Parameters #### Path Parameters - **id** (string) - Required - The ID of the config. #### Request Body - **options** (ConfigUpdateOptions) - Required - Options for updating the config. ``` -------------------------------- ### Define ImageBuildResult struct Source: https://pkg.go.dev/github.com/moby/moby/client Holds information returned by a server after building an image. ```go type ImageBuildResult struct { Body io.ReadCloser } ``` -------------------------------- ### Container Top Options Source: https://pkg.go.dev/github.com/moby/moby/client Options for the container top operation. ```APIDOC ## ContainerTopOptions ### Description Defines options for container top operations. ### Fields - **Arguments** ([]string) - A list of arguments to pass to the top command. ``` -------------------------------- ### PlatformInfo Source: https://pkg.go.dev/github.com/moby/moby/client Information about the platform the server is running on. ```APIDOC ## PlatformInfo ### Description Holds information about the platform (product name) the server is running on. ### Fields - **Name** (string) - The name of the platform (e.g., "Docker Engine - Community", or "Docker Desktop 4.49.0 (208003)"). ``` -------------------------------- ### Environment Configuration Source: https://pkg.go.dev/github.com/moby/moby/client Functions and constants used to configure the Docker client from environment variables. ```APIDOC ## func FromEnv ### Description Configures the client with values from environment variables. It is the equivalent of using the WithTLSClientConfigFromEnv, WithHostFromEnv, and WithAPIVersionFromEnv options. ### Environment Variables - **DOCKER_HOST** (EnvOverrideHost) - Sets the URL to the docker server. - **DOCKER_API_VERSION** (EnvOverrideAPIVersion) - Sets the version of the API to use. - **DOCKER_CERT_PATH** (EnvOverrideCertPath) - Directory to load TLS certificates (ca.pem, cert.pem, key.pem). - **DOCKER_TLS_VERIFY** (EnvTLSVerify) - Enables or disables TLS verification. ``` -------------------------------- ### ExecInspect API Source: https://pkg.go.dev/github.com/moby/moby/client Inspects a specific exec process on the Docker host to retrieve its information. ```APIDOC ## GET /exec/{id}/json ### Description Returns information about a specific exec process on the Docker host. ### Method GET ### Endpoint /exec/{id}/json ### Parameters #### Path Parameters - **id** (string) - Required - The ID of the exec process to inspect. #### Query Parameters - **options** (ExecInspectOptions) - Optional - Options for inspecting the exec process. ``` -------------------------------- ### Define ImageImportOptions Structure Source: https://pkg.go.dev/github.com/moby/moby/client ImageImportOptions holds information to import images from the client host. It includes fields for tagging, messages, changes, and platform. ```go type ImageImportOptions struct { Tag string // Tag is the name to tag this image with. This attribute is deprecated. Message string // Message is the message to tag the image with Changes []string // Changes are the raw changes to apply to this image Platform ocispec.Platform // Platform is the target platform of the image } ``` -------------------------------- ### ExecAttach API Source: https://pkg.go.dev/github.com/moby/moby/client Attaches a connection to an exec process in the server. ```APIDOC ## POST /exec/{id}/start ### Description Attaches a connection to an exec process in the server. Returns a HijackedResponse with the hijacked connection and a reader to get output. ### Method POST ### Endpoint /exec/{id}/start ### Parameters #### Path Parameters - **id** (string) - Required - The ID of the exec instance #### Query Parameters - **Detach** (boolean) - Optional - Detach from the command - **Tty** (boolean) - Optional - Allocate a pseudo-TTY ### Request Body - **AttachStdin** (boolean) - Optional - Attach to stdin - **AttachStdout** (boolean) - Optional - Attach to stdout - **AttachStderr** (boolean) - Optional - Attach to stderr ``` -------------------------------- ### Define ImageHistoryWithPlatform function Source: https://pkg.go.dev/github.com/moby/moby/client Sets the platform for the image history operation. ```go func ImageHistoryWithPlatform(platform ocispec.Platform) ImageHistoryOption ``` -------------------------------- ### Define TaskInspectOptions struct Source: https://pkg.go.dev/github.com/moby/moby/client Contains options for inspecting a task. ```go type TaskInspectOptions struct { } ``` -------------------------------- ### Checkpoint Create Options and Result Source: https://pkg.go.dev/github.com/moby/moby/client Defines options and result structures for creating a container checkpoint. ```APIDOC ## CheckpointCreateOptions ### Description CheckpointCreateOptions holds parameters to create a checkpoint from a container. ### Fields - **CheckpointID** (string) - The ID of the checkpoint. - **CheckpointDir** (string) - The directory to store the checkpoint. - **Exit** (bool) - Whether to exit the container after creating the checkpoint. ``` ```APIDOC ## CheckpointCreateResult ### Description CheckpointCreateResult holds the result from client.CheckpointCreate. ### Fields (No fields defined) ``` -------------------------------- ### System and Swarm API Source: https://pkg.go.dev/github.com/moby/moby/client Endpoints for registry authentication, server version retrieval, and swarm management. ```APIDOC ## RegistryLogin ### Description Authenticates the docker server with a given docker registry. ### Response - **RegistryLoginResult** (object) - Authentication result. ``` ```APIDOC ## ServerVersion ### Description Returns information of the Docker server host. ### Response - **ServerVersionResult** (object) - Server version information. ``` -------------------------------- ### Define ImageListOptions Structure Source: https://pkg.go.dev/github.com/moby/moby/client ImageListOptions holds parameters to list images with. It includes options for filtering, shared size computation, and manifest/identity retrieval. ```go type ImageListOptions struct { // All controls whether all images in the graph are filtered, or just // the heads. All bool // Filters is a JSON-encoded set of filter arguments. Filters Filters // SharedSize indicates whether the shared size of images should be computed. SharedSize bool // Manifests indicates whether the image manifests should be returned. Manifests bool // Identity indicates whether image identity information should be returned. Identity bool } ```