All methods are singular; while pruning will impact multiple items,
it's more consistent to use singular for all operations.
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This change adds type specific fields to `GET /system/df` endpoint with high level information of disk usage. This change also introduces `verbose` query to the endpoint so that detailed information is by default excluded unless queried to reduce memory consumption. The previous top level `DiskUsage` fields (`Images`, `Containers`, `Volumes` and `BuildCache`) are now deprecated and kept for backwards compatibility.
Co-authored-by: Claude <noreply@anthropic.com>
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
This utility is used to split the SecurityOptions field from the
"/info" response into a slice of security.Option. It's effectively
only used by the CLI to present the `docker info` output, but has
a use in buildx to parse the response.
We can assume the daemon returns a valid response, remove the error-
conditions and fallback for legacy daemon versions (< 1.13), and limit
it to parsing the response only.
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Use a more idiomatic name so that it can be used as `client.New()`.
We should look if we want `New()` to have different / updated defaults
i.e., enable `WithEnv` as default, and have an opt-out and have API-
version negotiation enabled by default (with an opt-out option).
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Some methods currently support a single platform only, but we may
be able to support multiple platforms.
This patch prepares the option-structs for multi-platform support,
but (for now) returning an error if multiple options are provided.
We need a similar check on the daemon-side, but still need to check
on the client, as older daemons will ignore multiple platforms, which
may be unexpected.
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Improve validation for empty name; while the daemon already handled empty
strings, it didn't account for the "canonical" name with "/" prefix, for
which it would produce an obscure error:
Error response from daemon: Error when allocating new name: Invalid container name (/ ), only [a-zA-Z0-9][a-zA-Z0-9_.-] are allowed
Before this change:
curl -XPOST --unix-socket /var/run/docker.sock 'http://localhost/v1.51/containers/old/rename?name='
{"message":"Neither old nor new names may be empty"}
curl -XPOST --unix-socket /var/run/docker.sock 'http://localhost/v1.51/containers/old/rename?name=/'
{"message":"Error when allocating new name: Invalid container name (/), only [a-zA-Z0-9][a-zA-Z0-9_.-] are allowed"}
curl -XPOST --unix-socket /var/run/docker.sock 'http://localhost/v1.51/containers/old/rename?name=/hello'
# OK
A check was added in the client as well for situations where an older daemon
is used; the same code currently was implemented in the CLI.
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>