1233 Commits

Author SHA1 Message Date
Sopho Merkviladze
a0b6dbc2fc api: add GET /images/{name}/attestations endpoint
Add a new Engine API endpoint that returns the in-toto attestation
statements attached to an image for a given platform. The endpoint
locates the attestation manifest(s) referencing the requested platform's
image manifest, enumerates the statement layers, and returns each
layer's OCI descriptor (including media type, digest, size, and
annotations) together with its in-toto predicate type.

Query parameters:
  - platform: JSON-encoded OCI platform; defaults to the daemon's host
    platform if omitted.
  - type: comma-separated list of in-toto predicate type URIs; if
    omitted, all statements are returned.
  - statement: boolean, defaults to false. When true, the daemon reads
    each matching statement blob and includes the verbatim in-toto JSON
    in the response. When false (or omitted), statement blobs are not
    read and the Statement field is absent from each entry.

The manifest-chain walk (locating the platform image manifest and its
associated attestation manifest) is delegated to policy-helpers'
image.ResolveSignatureChain so that moby and BuildKit agree on how to
interpret the attestation storage format. The statement-layer iteration
and blob reading is inlined: when statement bodies are requested it
fails fast on the first unreadable blob and reads matching blobs
eagerly into memory; otherwise statement-layer blobs are never read
from the content store.

The endpoint is implemented for the containerd image store. The legacy
graphdriver store returns errdefs.NotImplemented (HTTP 501).

Signed-off-by: Sopho Merkviladze <smerkviladze@mirantis.com>
2026-06-12 13:40:58 +04:00
Sebastiaan van Stijn
b8057a3a58 api/types/network: fix handling of unmapped ports (ephemeral ports)
commit 4c24542e95 changed `PortRange.All()`
to omit zero values for ports, but this caused a regression; the zero-value
is used in some places to assign an ephemeral port, e.g.: `--port 80` is an
implicit `--port 0:80`, or `--port <ephemeral port>:80`, where the daemon
picks a random port number from the ephemeral port range as host-port.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2026-04-02 11:49:01 +02:00
Sebastiaan van Stijn
d0a29867e7 api/types/strslice: add //go:fix inline directives for deprecated type
This allows `go fix ./..` to automatically migrate legacy code.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2026-03-17 18:23:09 +01:00
Sebastiaan van Stijn
a722b68f5c api/types/network: use blackbox testing for ports
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2026-03-14 00:52:01 +01:00
Sebastiaan van Stijn
91f3ec65e6 api/types/network: Port, PortRange: update godoc for "String()"
Call out that users should check if the port/port-range is valid
before consuming the value returned by String().

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2026-03-14 00:52:01 +01:00
Sebastiaan van Stijn
19ef53a52f api/types/network: add Port.Port()
This brings back the Port() method that was defined on the nat.Port type,
which was used in many places to (e.g.) do a network.JoinHostPort.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2026-03-14 00:52:00 +01:00
Sebastiaan van Stijn
4c24542e95 api/types/network: Port,PortRange: don't panic on zero values
- Prevent panic when calling .Proto() on zero values
- Don't iterate on zero-value port-ranges

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2026-03-14 00:51:53 +01:00
Paweł Gronowski
11d1267e88 Merge pull request #52030 from crazy-max/image-list-identity
image: add opt-in identity field to image list API for containerd backend
2026-02-27 18:31:01 +00:00
Paweł Gronowski
7adeea2af9 Merge pull request #52047 from thaJeztah/swarm_portspec_sorting
api/types/swarm: PortConfig: add Compare method
2026-02-27 16:27:40 +00:00
CrazyMax
6d133c5ec6 image: add opt-in identity support to image list API
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
2026-02-27 16:35:31 +01:00
Sebastiaan van Stijn
0e7c8176e8 api/types: add MediaType pseudo-type, and touch-up docs
Add a `MediaType` pseudo-type to help discoverability of mediatypes
we use, and slightly touch up the documentation.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2026-02-24 14:23:34 +01:00
Sebastiaan van Stijn
bdede35717 api/types/jsonstream: add sanity-check for Message marshaling
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2026-02-18 23:44:29 +01:00
Sebastiaan van Stijn
d00882aff2 api/types/jsonstream: prevent panic on nil-Error
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2026-02-18 23:41:48 +01:00
Sebastiaan van Stijn
9a9106b71a api/types/swarm: PortConfig: add Compare method
Add a compare function that can be used for slices.SortFunc to have
a canonical definition of sorting.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2026-02-15 19:02:07 +01:00
Sebastiaan van Stijn
62c1a719b3 api/types: use "omitzero" instead of "omitempty" for "netip" fields
Pull request 50956 (88adc28731) updated
various types in the API module from a string to a `netip.Prefix` or
`netip.Addr`. A side-effect of this was that zero values would no longer
be omitted, and instead marshaled as an empty string;

    package main

    import (
        "encoding/json"
        "fmt"
        "net/netip"
    )

    type Foo struct {
        OmitEmpty netip.Prefix `json:",omitempty"`
        OmitZero  netip.Prefix `json:",omitzero"`
    }

    func main() {
        out, _ := json.Marshal(Foo{})
        fmt.Println(string(out))
    }

The above produces `{"OmitEmpty":""}`, not omitting the empty address.

This patch;

- updates most types to use `omitzero` instead of `omitempty`.
- adds explicit `json` names to fields.

There's one type remaining that uses `omitzero`, but it's generated by
go-swagger, which currently doesn't support `omitzero`; the `PortSummary.IP`;
335f60509f/api/types/container/port_summary.go (L12-L20)

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2026-01-26 15:57:18 +01:00
Sebastiaan van Stijn
f3343bf846 api/types: gofumpt
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2026-01-24 17:14:59 +01:00
Sebastiaan van Stijn
26e8376a3c api: fix grammar: user defined / user specified -> user-(defined|specified)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2026-01-21 15:31:18 +01:00
Tonis Tiigi
1d4e04bed1 api: add inspect identity base type to expose trusted image origin
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2026-01-16 08:04:36 -08:00
Sebastiaan van Stijn
e09afad3cb api/types/network: remove use of "reflect" in test
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-12-23 11:26:32 +01:00
Austin Vazquez
0f0d197d78 Merge pull request #51760 from thaJeztah/fix_godoc
api/types/jsonstream: Message: fix godoc
2025-12-18 13:07:27 -06:00
Sebastiaan van Stijn
0fd5cc134b api/types/jsonstream: Message: fix godoc
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-12-18 15:04:27 +01:00
Sebastiaan van Stijn
6c845ded18 api/types/swarm: ResourceRequirements.MemorySwappiness: fix json tag
types/swarm/task.go:151:2: structtag: struct field tag `json:MemorySwappiness,omitzero"` not compatible with reflect.StructTag.Get: bad syntax for struct tag value (govet)
        MemorySwappiness *int64 `json:MemorySwappiness,omitzero"`
        ^

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-12-18 15:03:13 +01:00
Nicolas De Loof
aef5d996ce use mime-type application/jsonl to align with openapi 3.2
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-12-17 11:37:48 +01:00
Brian Goff
2ec5bdfaf6 Merge pull request #51666 from ndeloof/swagger
simplify swagger generation
2025-12-15 08:13:20 -08:00
Rob Murray
7c7a626e5d NRI: include in API Info response
Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-12-15 10:36:05 +00:00
Nicolas De Loof
caaa9c9bb5 simplify swagger generation
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2025-12-12 09:19:50 +01:00
Sebastiaan van Stijn
e8f156110a api/types/plugin: remove deprecated Config.DockerVersion
This was deprecated in c4fda95bea, and
already omitted.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-11-10 18:11:45 +01:00
Paweł Gronowski
7cff366d43 Merge pull request #51439 from thaJeztah/concrete_enums
api/types/container: make ContainerState, HealthStatus concrete types
2025-11-10 16:21:22 +01:00
Paweł Gronowski
f57da07056 Merge pull request #51454 from thaJeztah/api_volumes_no_pointer
api/types/volume: change ListResponse.Volumes to a non-pointer slice
2025-11-10 16:20:16 +01:00
Sebastiaan van Stijn
db71c6a914 api/types/container: make HealthStatus a concrete type
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-11-10 16:08:15 +01:00
Sebastiaan van Stijn
1fd87e9fdf api/types/container: make ContainerState a concrete type
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-11-10 16:08:12 +01:00
Rob Murray
69c4524355 Merge pull request #51437 from thaJeztah/diskusage_move_legacy
api: remove / internalize LegacyDiskUsage
2025-11-10 15:03:37 +00:00
Sebastiaan van Stijn
18000fe371 api/types/volume: change ListResponse.Volumes to a non-pointer slice
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-11-10 13:13:22 +01:00
Sebastiaan van Stijn
15a048c396 api, client: don't use a pointer-slice for plugins
The backend and router don't use a pointer-slice (the server actually
doesn't use the `plugin.ListResponse` type and a straight slice);
778e5bfad3/daemon/server/router/plugin/backend.go (L20)
6baf274fa3/daemon/server/router/plugin/plugin_routes.go (L276-L280)

Align the type in the API to match, and update the type defined in the
client accordingly.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-11-07 21:02:26 +01:00
Sebastiaan van Stijn
ed428234bd api: remove / internalize LegacyDiskUsage
These fields have been removed from the API specification, and the struct
was only needed to produce legacy responses (server), or to unmarshal
legacy responses in the client.

As the API module only provides API definitions for the current API version,
we should remove these legacy structs, and keep them internal to the daemon
and client.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-11-07 20:16:03 +01:00
Austin Vazquez
931c347b36 api/types: rename disk usage fields
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-11-06 16:21:32 -06:00
Sebastiaan van Stijn
0029924181 api/types/system: change legacyDiskUsage to a non-pointer slice
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-11-06 12:31:05 +01:00
Austin Vazquez
6881ae72c7 api/types: use regular slices for disk usage types
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-11-05 22:05:47 -06:00
Austin Vazquez
fabdccbe10 api/types: move disk usage structs to per type packages
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-11-05 11:20:15 -06:00
Sebastiaan van Stijn
cdede16ce7 Merge pull request #51399 from thaJeztah/swarm_enums
api/types/swarm: create types for enum-consts
2025-11-05 16:33:20 +01:00
Sebastiaan van Stijn
39ccd04ca8 api/types/swarm: define type for RegistryAuthSource
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-11-05 13:48:38 +01:00
Sebastiaan van Stijn
d299e5be83 api/types/swarm: define type for UpdateOrder
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-11-05 12:50:51 +01:00
Sebastiaan van Stijn
b552b8b729 api/types/swarm: define type for FailureAction
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-11-05 12:50:48 +01:00
Austin Vazquez
a69abdd90d api/types/system: add type specific usage fields to DiskUsage
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>
2025-11-03 16:34:26 -06:00
Sebastiaan van Stijn
12c9de37e9 api/types: move Version to api/types/system
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-31 02:09:38 +01:00
Sebastiaan van Stijn
ebe464ea45 api/types: remove PushResult type, and move internal
This type was used as Aux message for docker push, was not documented,
and only present for Docker Content Trust (which is deprecated).

This patch removes it from the API module, and moves the type internal.
We can stop sending this Aux message once DCT is fully phased out.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-31 00:47:23 +01:00
Cory Snider
19f4c27d81 api/t/network: represent MAC addrs as byte slices
Make invalid states unrepresentable by moving away from stringly-typed
MAC address values in API structs. As go.dev/issue/29678 has not yet
been implemented, provide our own HardwareAddr byte-slice type which
implements TextMarshaler and TextUnmarshaler to retain compatibility
with the API wire format.

When stdlib's net.HardwareAddr type implements TextMarshaler and
TextUnmarshaler and GODEBUG=netmarshal becomes the default, we should be
able to make the type a straight alias for stdlib net.HardwareAddr as a
non-breaking change.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2025-10-30 17:11:38 -04:00
Sebastiaan van Stijn
0eba2989e0 api/types/registry: rename AuthenticateOKBody to AuthResponse
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-29 18:06:29 +01:00
Austin Vazquez
bae45f766d api/types/network: define ConnectRequest and DisconnectRequest
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-10-29 11:44:18 +01:00
Sebastiaan van Stijn
9e7e01ef16 Merge pull request #51153 from corhere/excise-json-streams-from-api
api: move `pkg/streamformatter`, `pkg/progress` to `daemon/internal`
2025-10-28 13:36:16 +01:00