Bjorn Neergaard 427f95c4e6 Merge pull request #45978 from thaJeztah/client_docs_touch_up há 2 anos atrás
..
buildkit 713c9280ca Move buildkit client opts to new package há 2 anos atrás
testdata 7c36a1af03 Move engine-api client package há 8 anos atrás
README.md c8ff5ecc09 Remove use of deprecated client.NewEnvClient() há 6 anos atrás
build_cancel.go 8128a9a478 Fix grammar in client function comments há 4 anos atrás
build_prune.go 07b2e4cb79 client: use strconv instead of fmt.Sprintf() há 2 anos atrás
checkpoint_create.go 7d62e40f7e Switch from x/net/context -> context há 7 anos atrás
checkpoint_create_test.go 0af6d9e291 client: format code with gofumpt há 2 anos atrás
checkpoint_delete.go 7d62e40f7e Switch from x/net/context -> context há 7 anos atrás
checkpoint_delete_test.go 0af6d9e291 client: format code with gofumpt há 2 anos atrás
checkpoint_list.go 45067cda33 client: remove wrapResponseError() há 3 anos atrás
checkpoint_list_test.go 66ff1e063e client: update error-assertions in tests há 2 anos atrás
client.go 8d514f4e2e client: touch-up docs, and user doc-links há 2 anos atrás
client_deprecated.go 6b9968e8b1 client: deprecate NewClient properly há 2 anos atrás
client_mock_test.go c55a4ac779 refactor: move from io/ioutil to io and os package há 3 anos atrás
client_test.go 9d1e690751 client: TestGetAPIPath: don't use un-keyed structs há 2 anos atrás
client_unix.go ab35df454d remove pre-go1.17 build-tags há 2 anos atrás
client_windows.go 31ee158394 client: defaultHTTPClient() accept URL há 2 anos atrás
config_create.go 8128a9a478 Fix grammar in client function comments há 4 anos atrás
config_create_test.go 66ff1e063e client: update error-assertions in tests há 2 anos atrás
config_inspect.go 45067cda33 client: remove wrapResponseError() há 3 anos atrás
config_inspect_test.go 66ff1e063e client: update error-assertions in tests há 2 anos atrás
config_list.go 9c846b2fcc Client: always call ensureReaderClosed há 6 anos atrás
config_list_test.go 66ff1e063e client: update error-assertions in tests há 2 anos atrás
config_remove.go 45067cda33 client: remove wrapResponseError() há 3 anos atrás
config_remove_test.go 66ff1e063e client: update error-assertions in tests há 2 anos atrás
config_update.go d9524d92a9 api/types/swarm: Version: implement stringer interface há 3 anos atrás
config_update_test.go 66ff1e063e client: update error-assertions in tests há 2 anos atrás
container_attach.go 83477ce8d0 client: remove custom "headers" type, and use "http.Header" instead há 2 anos atrás
container_commit.go 8128a9a478 Fix grammar in client function comments há 4 anos atrás
container_commit_test.go 66ff1e063e client: update error-assertions in tests há 2 anos atrás
container_copy.go 013d648888 client: CopyToContainer(), CopyFromContainer(): remove status-code handling há 3 anos atrás
container_copy_test.go 0af6d9e291 client: format code with gofumpt há 2 anos atrás
container_create.go 2216d3ca8d Add health start interval há 2 anos atrás
container_create_test.go 66ff1e063e client: update error-assertions in tests há 2 anos atrás
container_diff.go dbb48e4b29 api/types/container: create type for changes endpoint há 2 anos atrás
container_diff_test.go 66cf0e3f55 client: slightly improve ContainerDiff tests há 2 anos atrás
container_exec.go 83477ce8d0 client: remove custom "headers" type, and use "http.Header" instead há 2 anos atrás
container_exec_test.go 66ff1e063e client: update error-assertions in tests há 2 anos atrás
container_export.go 7d62e40f7e Switch from x/net/context -> context há 7 anos atrás
container_export_test.go 66ff1e063e client: update error-assertions in tests há 2 anos atrás
container_inspect.go 45067cda33 client: remove wrapResponseError() há 3 anos atrás
container_inspect_test.go 66ff1e063e client: update error-assertions in tests há 2 anos atrás
container_kill.go b365924ec3 client: ContainerKill(): don't send signal query-param if none was set há 3 anos atrás
container_kill_test.go 66ff1e063e client: update error-assertions in tests há 2 anos atrás
container_list.go 0af6d9e291 client: format code with gofumpt há 2 anos atrás
container_list_test.go 66ff1e063e client: update error-assertions in tests há 2 anos atrás
container_logs.go 52c1a2fae8 gofmt GoDoc comments with go1.19 há 3 anos atrás
container_logs_test.go 66ff1e063e client: update error-assertions in tests há 2 anos atrás
container_pause.go 7d62e40f7e Switch from x/net/context -> context há 7 anos atrás
container_pause_test.go 66ff1e063e client: update error-assertions in tests há 2 anos atrás
container_prune.go 9c846b2fcc Client: always call ensureReaderClosed há 6 anos atrás
container_prune_test.go 66ff1e063e client: update error-assertions in tests há 2 anos atrás
container_remove.go 45067cda33 client: remove wrapResponseError() há 3 anos atrás
container_remove_test.go 66ff1e063e client: update error-assertions in tests há 2 anos atrás
container_rename.go 7d62e40f7e Switch from x/net/context -> context há 7 anos atrás
container_rename_test.go 66ff1e063e client: update error-assertions in tests há 2 anos atrás
container_resize.go 7d62e40f7e Switch from x/net/context -> context há 7 anos atrás
container_resize_test.go 66ff1e063e client: update error-assertions in tests há 2 anos atrás
container_restart.go e8fa708ae5 client: ContainerStop(), ContainerRestart(): support stop-signal há 3 anos atrás
container_restart_test.go 66ff1e063e client: update error-assertions in tests há 2 anos atrás
container_start.go 7d62e40f7e Switch from x/net/context -> context há 7 anos atrás
container_start_test.go 66ff1e063e client: update error-assertions in tests há 2 anos atrás
container_stats.go 2da589d454 client: return explicit "nil" for no errors, and remove nil check há 2 anos atrás
container_stats_test.go 66ff1e063e client: update error-assertions in tests há 2 anos atrás
container_stop.go e8fa708ae5 client: ContainerStop(), ContainerRestart(): support stop-signal há 3 anos atrás
container_stop_test.go 66ff1e063e client: update error-assertions in tests há 2 anos atrás
container_top.go 9c846b2fcc Client: always call ensureReaderClosed há 6 anos atrás
container_top_test.go 66ff1e063e client: update error-assertions in tests há 2 anos atrás
container_unpause.go 7d62e40f7e Switch from x/net/context -> context há 7 anos atrás
container_unpause_test.go 66ff1e063e client: update error-assertions in tests há 2 anos atrás
container_update.go 8128a9a478 Fix grammar in client function comments há 4 anos atrás
container_update_test.go 66ff1e063e client: update error-assertions in tests há 2 anos atrás
container_wait.go 9900c7a348 client: improve error messaging on crash há 2 anos atrás
container_wait_test.go 66ff1e063e client: update error-assertions in tests há 2 anos atrás
disk_usage.go 47ad2f3dd6 API,daemon: support `type` URL parameter to /system/df há 4 anos atrás
disk_usage_test.go 66ff1e063e client: update error-assertions in tests há 2 anos atrás
distribution_inspect.go 83477ce8d0 client: remove custom "headers" type, and use "http.Header" instead há 2 anos atrás
distribution_inspect_test.go 66ff1e063e client: update error-assertions in tests há 2 anos atrás
envvars.go 5979d6e7e3 client: add const for environment variables, and document them há 3 anos atrás
errors.go 685b3d820a client: make IsErrNotFound an alias for errdefs.IsNotFound há 2 anos atrás
events.go cd51c9fafb client: fix empty-lines (revive) há 2 anos atrás
events_test.go 66ff1e063e client: update error-assertions in tests há 2 anos atrás
hijack.go c219b09d4a client: Client.postHijacked: use Client.buildRequest há 2 anos atrás
hijack_test.go c55a4ac779 refactor: move from io/ioutil to io and os package há 3 anos atrás
image_build.go 83477ce8d0 client: remove custom "headers" type, and use "http.Header" instead há 2 anos atrás
image_build_test.go 66ff1e063e client: update error-assertions in tests há 2 anos atrás
image_create.go 83477ce8d0 client: remove custom "headers" type, and use "http.Header" instead há 2 anos atrás
image_create_test.go 66ff1e063e client: update error-assertions in tests há 2 anos atrás
image_history.go 9c846b2fcc Client: always call ensureReaderClosed há 6 anos atrás
image_history_test.go 66ff1e063e client: update error-assertions in tests há 2 anos atrás
image_import.go 8128a9a478 Fix grammar in client function comments há 4 anos atrás
image_import_test.go 66ff1e063e client: update error-assertions in tests há 2 anos atrás
image_inspect.go 45067cda33 client: remove wrapResponseError() há 3 anos atrás
image_inspect_test.go 66ff1e063e client: update error-assertions in tests há 2 anos atrás
image_list.go 3d97f1e22d client/list: Handle SharedSize há 2 anos atrás
image_list_test.go 66ff1e063e client: update error-assertions in tests há 2 anos atrás
image_load.go 83477ce8d0 client: remove custom "headers" type, and use "http.Header" instead há 2 anos atrás
image_load_test.go 66ff1e063e client: update error-assertions in tests há 2 anos atrás
image_prune.go 9c846b2fcc Client: always call ensureReaderClosed há 6 anos atrás
image_prune_test.go 66ff1e063e client: update error-assertions in tests há 2 anos atrás
image_pull.go 0cafc84fb2 Use errdefs for handling errors in client há 6 anos atrás
image_pull_test.go 66ff1e063e client: update error-assertions in tests há 2 anos atrás
image_push.go 83477ce8d0 client: remove custom "headers" type, and use "http.Header" instead há 2 anos atrás
image_push_test.go 66ff1e063e client: update error-assertions in tests há 2 anos atrás
image_remove.go 45067cda33 client: remove wrapResponseError() há 3 anos atrás
image_remove_test.go 66ff1e063e client: update error-assertions in tests há 2 anos atrás
image_save.go 7d62e40f7e Switch from x/net/context -> context há 7 anos atrás
image_save_test.go 66ff1e063e client: update error-assertions in tests há 2 anos atrás
image_search.go 83477ce8d0 client: remove custom "headers" type, and use "http.Header" instead há 2 anos atrás
image_search_test.go 66ff1e063e client: update error-assertions in tests há 2 anos atrás
image_tag.go 7d62e40f7e Switch from x/net/context -> context há 7 anos atrás
image_tag_test.go 4e69e16fde client: use string-literals for easier grep'ing há 2 anos atrás
info.go c90229ed9a api/types: move system info types to api/types/system há 2 anos atrás
info_test.go c90229ed9a api/types: move system info types to api/types/system há 2 anos atrás
interface.go c90229ed9a api/types: move system info types to api/types/system há 2 anos atrás
interface_experimental.go 7d62e40f7e Switch from x/net/context -> context há 7 anos atrás
interface_stable.go 4f0d95fa6e Add canonical import comment há 7 anos atrás
login.go eaf1a604f2 client: use types/registry.AuthConfig há 3 anos atrás
network_connect.go 7d62e40f7e Switch from x/net/context -> context há 7 anos atrás
network_connect_test.go 66ff1e063e client: update error-assertions in tests há 2 anos atrás
network_create.go 9c846b2fcc Client: always call ensureReaderClosed há 6 anos atrás
network_create_test.go 66ff1e063e client: update error-assertions in tests há 2 anos atrás
network_disconnect.go 7d62e40f7e Switch from x/net/context -> context há 7 anos atrás
network_disconnect_test.go 66ff1e063e client: update error-assertions in tests há 2 anos atrás
network_inspect.go 45067cda33 client: remove wrapResponseError() há 3 anos atrás
network_inspect_test.go 66ff1e063e client: update error-assertions in tests há 2 anos atrás
network_list.go 5f47cef514 fix nolint comments for SA1019: filters.ToParamWithVersion is deprecated há 5 anos atrás
network_list_test.go 66ff1e063e client: update error-assertions in tests há 2 anos atrás
network_prune.go 9c846b2fcc Client: always call ensureReaderClosed há 6 anos atrás
network_prune_test.go 66ff1e063e client: update error-assertions in tests há 2 anos atrás
network_remove.go 45067cda33 client: remove wrapResponseError() há 3 anos atrás
network_remove_test.go 66ff1e063e client: update error-assertions in tests há 2 anos atrás
node_inspect.go 45067cda33 client: remove wrapResponseError() há 3 anos atrás
node_inspect_test.go 66ff1e063e client: update error-assertions in tests há 2 anos atrás
node_list.go 0af6d9e291 client: format code with gofumpt há 2 anos atrás
node_list_test.go 66ff1e063e client: update error-assertions in tests há 2 anos atrás
node_remove.go 45067cda33 client: remove wrapResponseError() há 3 anos atrás
node_remove_test.go 66ff1e063e client: update error-assertions in tests há 2 anos atrás
node_update.go d9524d92a9 api/types/swarm: Version: implement stringer interface há 3 anos atrás
node_update_test.go 66ff1e063e client: update error-assertions in tests há 2 anos atrás
options.go 077049d0b9 client: WithTLSClientConfig: return early if no transport is set há 2 anos atrás
options_test.go a6048fc792 client: add WithUserAgent() option há 2 anos atrás
ping.go 19cd5ff164 client: use strings.Cut() há 2 anos atrás
ping_test.go 66ff1e063e client: update error-assertions in tests há 2 anos atrás
plugin_create.go 9c846b2fcc Client: always call ensureReaderClosed há 6 anos atrás
plugin_disable.go 7d62e40f7e Switch from x/net/context -> context há 7 anos atrás
plugin_disable_test.go 66ff1e063e client: update error-assertions in tests há 2 anos atrás
plugin_enable.go 7d62e40f7e Switch from x/net/context -> context há 7 anos atrás
plugin_enable_test.go 66ff1e063e client: update error-assertions in tests há 2 anos atrás
plugin_inspect.go 45067cda33 client: remove wrapResponseError() há 3 anos atrás
plugin_inspect_test.go 66ff1e063e client: update error-assertions in tests há 2 anos atrás
plugin_install.go 83477ce8d0 client: remove custom "headers" type, and use "http.Header" instead há 2 anos atrás
plugin_list.go 45067cda33 client: remove wrapResponseError() há 3 anos atrás
plugin_list_test.go 66ff1e063e client: update error-assertions in tests há 2 anos atrás
plugin_push.go 83477ce8d0 client: remove custom "headers" type, and use "http.Header" instead há 2 anos atrás
plugin_push_test.go 66ff1e063e client: update error-assertions in tests há 2 anos atrás
plugin_remove.go 45067cda33 client: remove wrapResponseError() há 3 anos atrás
plugin_remove_test.go 66ff1e063e client: update error-assertions in tests há 2 anos atrás
plugin_set.go 7d62e40f7e Switch from x/net/context -> context há 7 anos atrás
plugin_set_test.go 66ff1e063e client: update error-assertions in tests há 2 anos atrás
plugin_upgrade.go 83477ce8d0 client: remove custom "headers" type, and use "http.Header" instead há 2 anos atrás
request.go 2da589d454 client: return explicit "nil" for no errors, and remove nil check há 2 anos atrás
request_test.go 92975f0c11 client: define a "dummy" hostname to use for local connections há 2 anos atrás
secret_create.go 8128a9a478 Fix grammar in client function comments há 4 anos atrás
secret_create_test.go 66ff1e063e client: update error-assertions in tests há 2 anos atrás
secret_inspect.go 45067cda33 client: remove wrapResponseError() há 3 anos atrás
secret_inspect_test.go 66ff1e063e client: update error-assertions in tests há 2 anos atrás
secret_list.go 9c846b2fcc Client: always call ensureReaderClosed há 6 anos atrás
secret_list_test.go 66ff1e063e client: update error-assertions in tests há 2 anos atrás
secret_remove.go 45067cda33 client: remove wrapResponseError() há 3 anos atrás
secret_remove_test.go 66ff1e063e client: update error-assertions in tests há 2 anos atrás
secret_update.go d9524d92a9 api/types/swarm: Version: implement stringer interface há 3 anos atrás
secret_update_test.go 66ff1e063e client: update error-assertions in tests há 2 anos atrás
service_create.go 83477ce8d0 client: remove custom "headers" type, and use "http.Header" instead há 2 anos atrás
service_create_test.go 0af6d9e291 client: format code with gofumpt há 2 anos atrás
service_inspect.go 45067cda33 client: remove wrapResponseError() há 3 anos atrás
service_inspect_test.go 66ff1e063e client: update error-assertions in tests há 2 anos atrás
service_list.go f36042d259 Add support for sending down service Running and Desired task counts há 5 anos atrás
service_list_test.go 66ff1e063e client: update error-assertions in tests há 2 anos atrás
service_logs.go 48cfe3f087 Improve GetTimestamp parsing há 7 anos atrás
service_logs_test.go 66ff1e063e client: update error-assertions in tests há 2 anos atrás
service_remove.go 45067cda33 client: remove wrapResponseError() há 3 anos atrás
service_remove_test.go 66ff1e063e client: update error-assertions in tests há 2 anos atrás
service_update.go 83477ce8d0 client: remove custom "headers" type, and use "http.Header" instead há 2 anos atrás
service_update_test.go 66ff1e063e client: update error-assertions in tests há 2 anos atrás
swarm_get_unlock_key.go 9c846b2fcc Client: always call ensureReaderClosed há 6 anos atrás
swarm_get_unlock_key_test.go 66ff1e063e client: update error-assertions in tests há 2 anos atrás
swarm_init.go 9c846b2fcc Client: always call ensureReaderClosed há 6 anos atrás
swarm_init_test.go 66ff1e063e client: update error-assertions in tests há 2 anos atrás
swarm_inspect.go 9c846b2fcc Client: always call ensureReaderClosed há 6 anos atrás
swarm_inspect_test.go 66ff1e063e client: update error-assertions in tests há 2 anos atrás
swarm_join.go 7d62e40f7e Switch from x/net/context -> context há 7 anos atrás
swarm_join_test.go 66ff1e063e client: update error-assertions in tests há 2 anos atrás
swarm_leave.go 7d62e40f7e Switch from x/net/context -> context há 7 anos atrás
swarm_leave_test.go 66ff1e063e client: update error-assertions in tests há 2 anos atrás
swarm_unlock.go 7d62e40f7e Switch from x/net/context -> context há 7 anos atrás
swarm_unlock_test.go 66ff1e063e client: update error-assertions in tests há 2 anos atrás
swarm_update.go d9524d92a9 api/types/swarm: Version: implement stringer interface há 3 anos atrás
swarm_update_test.go 66ff1e063e client: update error-assertions in tests há 2 anos atrás
task_inspect.go 45067cda33 client: remove wrapResponseError() há 3 anos atrás
task_inspect_test.go 66ff1e063e client: update error-assertions in tests há 2 anos atrás
task_list.go 9c846b2fcc Client: always call ensureReaderClosed há 6 anos atrás
task_list_test.go 66ff1e063e client: update error-assertions in tests há 2 anos atrás
task_logs.go 7d62e40f7e Switch from x/net/context -> context há 7 anos atrás
transport.go 4f0d95fa6e Add canonical import comment há 7 anos atrás
utils.go 4f0d95fa6e Add canonical import comment há 7 anos atrás
version.go 9c846b2fcc Client: always call ensureReaderClosed há 6 anos atrás
volume_create.go 64e96932bd api: rename volume.VolumeCreateBody to volume.CreateOptions há 3 anos atrás
volume_create_test.go 66ff1e063e client: update error-assertions in tests há 2 anos atrás
volume_inspect.go 176f66df9c api/types: replace uses of deprecated types.Volume with volume.Volume há 3 anos atrás
volume_inspect_test.go 66ff1e063e client: update error-assertions in tests há 2 anos atrás
volume_list.go 340711db3d api: add types/volume.ListOptions for a more consistent API há 2 anos atrás
volume_list_test.go 66ff1e063e client: update error-assertions in tests há 2 anos atrás
volume_prune.go 9c846b2fcc Client: always call ensureReaderClosed há 6 anos atrás
volume_remove.go 45067cda33 client: remove wrapResponseError() há 3 anos atrás
volume_remove_test.go 66ff1e063e client: update error-assertions in tests há 2 anos atrás
volume_update.go d9524d92a9 api/types/swarm: Version: implement stringer interface há 3 anos atrás
volume_update_test.go 66ff1e063e client: update error-assertions in tests há 2 anos atrás

README.md

Go client for the Docker Engine API

The docker command uses this package to communicate with the daemon. It can also be used by your own Go applications to do anything the command-line interface does – running containers, pulling images, managing swarms, etc.

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

package main

import (
	"context"
	"fmt"

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

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

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

	for _, container := range containers {
		fmt.Printf("%s %s\n", container.ID[:10], container.Image)
	}
}

Full documentation is available on GoDoc.