d738e7c489
The docker info output contains both "local" and "remote" (daemon-side) information. The API endpoint to collect daemon information (`/info`) is known to be "heavy", and (depending on what information is needed) not needed. This patch checks if the template (`--format`) used requires information from the daemon, and if not, omits making an API request. This will improve performance if (for example), the current "context" is requested from `docker info` or if only plugin information is requested. Before: time docker info --format '{{range .ClientInfo.Plugins}}Plugin: {{.Name}}, {{end}}' Plugin: buildx, Plugin: compose, Plugin: scan, ________________________________________________________ Executed in 301.91 millis fish external usr time 168.64 millis 82.00 micros 168.56 millis sys time 113.72 millis 811.00 micros 112.91 millis time docker info --format '{{json .ClientInfo.Plugins}}' time docker info --format '{{.ClientInfo.Context}}' default ________________________________________________________ Executed in 334.38 millis fish external usr time 177.23 millis 93.00 micros 177.13 millis sys time 124.90 millis 927.00 micros 123.97 millis docker context use remote-ssh-daemon time docker info --format '{{.ClientInfo.Context}}' remote-ssh-daemon ________________________________________________________ Executed in 1.22 secs fish external usr time 116.93 millis 110.00 micros 116.82 millis sys time 144.36 millis 887.00 micros 143.47 millis And daemon logs: Jul 06 12:42:12 remote-ssh-daemon dockerd[14377]: time="2021-07-06T12:42:12.139529947Z" level=debug msg="Calling HEAD /_ping" Jul 06 12:42:12 remote-ssh-daemon dockerd[14377]: time="2021-07-06T12:42:12.140772052Z" level=debug msg="Calling HEAD /_ping" Jul 06 12:42:12 remote-ssh-daemon dockerd[14377]: time="2021-07-06T12:42:12.163832016Z" level=debug msg="Calling GET /v1.41/info" After: time ./build/docker info --format '{{range .ClientInfo.Plugins}}Plugin: {{.Name}}, {{end}}' Plugin: buildx, Plugin: compose, Plugin: scan, ________________________________________________________ Executed in 139.84 millis fish external usr time 76.53 millis 62.00 micros 76.46 millis sys time 69.25 millis 723.00 micros 68.53 millis time ./build/docker info --format '{{.ClientInfo.Context}}' default ________________________________________________________ Executed in 136.94 millis fish external usr time 74.61 millis 74.00 micros 74.54 millis sys time 65.77 millis 858.00 micros 64.91 millis docker context use remote-ssh-daemon time ./build/docker info --format '{{.ClientInfo.Context}}' remote-ssh-daemon ________________________________________________________ Executed in 1.02 secs fish external usr time 74.25 millis 76.00 micros 74.17 millis sys time 65.09 millis 643.00 micros 64.44 millis And daemon logs: Jul 06 12:42:55 remote-ssh-daemon dockerd[14377]: time="2021-07-06T12:42:55.313654687Z" level=debug msg="Calling HEAD /_ping" Jul 06 12:42:55 remote-ssh-daemon dockerd[14377]: time="2021-07-06T12:42:55.314811624Z" level=debug msg="Calling HEAD /_ping" Signed-off-by: Sebastiaan van Stijn <github@gone.nl> |
||
---|---|---|
.circleci | ||
.github | ||
cli | ||
cli-plugins | ||
cmd/docker | ||
contrib/completion | ||
dockerfiles | ||
docs | ||
e2e | ||
experimental | ||
internal/test | ||
kubernetes | ||
man | ||
opts | ||
scripts | ||
service/logs | ||
templates | ||
vendor | ||
.dockerignore | ||
.gitignore | ||
.golangci.yml | ||
.mailmap | ||
AUTHORS | ||
CONTRIBUTING.md | ||
Dockerfile | ||
Jenkinsfile | ||
LICENSE | ||
MAINTAINERS | ||
Makefile | ||
NOTICE | ||
README.md | ||
TESTING.md | ||
VERSION | ||
appveyor.yml | ||
codecov.yml | ||
docker-bake.hcl | ||
docker.Makefile | ||
poule.yml | ||
vendor.conf |
README.md
docker/cli
This repository is the home of the cli used in the Docker CE and Docker EE products.
Development
docker/cli
is developed using Docker.
Build CLI from source:
$ docker buildx bake
Build binaries for all supported platforms:
$ docker buildx bake cross
Build for a specific platform:
$ docker buildx bake --set binary.platform=linux/arm64
Build dynamic binary for glibc or musl:
$ USE_GLIBC=1 docker buildx bake dynbinary
Run all linting:
$ make -f docker.Makefile lint
List all the available targets:
$ make help
In-container development environment
Start an interactive development environment:
$ make -f docker.Makefile shell
Legal
Brought to you courtesy of our legal counsel. For more context, please see the NOTICE document in this repo.
Use and transfer of Docker may be subject to certain restrictions by the United States and other governments.
It is your responsibility to ensure that your use and/or transfer does not violate applicable laws.
For more information, please see https://www.bis.doc.gov
Licensing
docker/cli is licensed under the Apache License, Version 2.0. See LICENSE for the full license text.