4561 Commits

Author SHA1 Message Date
Sebastiaan van Stijn
044234f847 api/docs: add v1.52 swagger
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-04 18:13:23 +02:00
Derek McGowan
59e8fe8479 Prepare release notes for v1.52.0
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-08-04 08:39:16 -07:00
Akihiro Suda
e87a2d662e Merge pull request #50608 from thaJeztah/no_reflect
api/types/strslice: use slices.Equal
2025-08-04 13:38:06 +09:00
Sebastiaan van Stijn
752a3b302c api/pkg/stdcopy: add example
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-02 22:39:00 +02:00
Sebastiaan van Stijn
26cf610e6e api/pkg/stdcopy: improve docs
- Outline the purpose of the Stdin and Systemerr streams and how
  they're used.
- Update docs for StdCopy function
- Touch-up error for unknown stream types

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-02 18:37:16 +02:00
Sebastiaan van Stijn
c010c84ade api/pkg/stdcopy: don't use iota for consts
iota can be convenient for internal use for cases where the value
doesn't matter. It can be a footgun when using it to define public
values; it's easy to accidentally change values (e.g. by re-ordering
or adding a value), which may go undetected within our code because
both producer and consumer would be updated.

This patch updates these consts to have a concrete value, because it's
part of the API contract and must not be changed.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-02 17:23:51 +02:00
Sebastiaan van Stijn
908895b9c3 api: update "interface{}" to "any"
Keep the linters happier.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-02 01:27:06 +02:00
Sebastiaan van Stijn
51bbc37f64 api/types/strslice: use slices.Equal
[Open Source Insights], which is linked from [pkg.go.dev] flagged
the API module to have [CAPABILITY_REFLECT], because it detected
"reflect" to be imported.

Let's use the slices package, which should do the job for these
tests.

[Open Source Insights]: https://deps.dev/go/github.com%2Fmoby%2Fmoby%2Fapi/v0.0.0-20250801143505-5f121ce46324/analysis
[pkg.go.dev]: https://pkg.go.dev/github.com/moby/moby/api@v0.0.0-20250801143505-5f121ce46324
[CAPABILITY_REFLECT]: 3166f9ba9d/docs/capabilities.md (capability_reflect)

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-02 00:56:26 +02:00
Cory Snider
ee560a3b23 api/types: fix Plugin.Config.Interface.Types def'n
The wire type of Plugin.Config.Interface.Types is an array of strings,
not of objects with three properties. We just so happen to have a Go
struct type to represent a plugin-interface-type value in memory with
all the fields parsed out for convenience, but that is not part of the
REST API contract documented by the Swager spec.U pdate the Swagger spec
to correctly document that the Types property is an array of strings in
the API, while still generating Go definitions that unmarshal into the
convenient struct type.

Move the definition and marshal/unmarshal methods for
PluginInterfaceType into a more appropriate location than api/types.
Rename the type to one that does not stutter or overload already
heavily overloaded terminology.

Modernize the parser and use property-based testing to assert that it
behaves the same as the old parser for all well-formed inputs.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2025-08-01 13:37:20 -04:00
Cory Snider
2783f80ecf api/types: generate with latest go-swagger
Override some of the templates to suppress emitting unwanted validation
and marshal/unmarshal code.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2025-08-01 13:30:23 -04:00
Sebastiaan van Stijn
49aa38e9e7 update links to swarmkit v2 docs
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-01 01:49:04 +02:00
Sebastiaan van Stijn
c98e5cb60b update github links to moby/moby
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-01 01:48:55 +02:00
Sebastiaan van Stijn
e55d294ea7 api/types/registry: add TODO/note about empty authConfigs
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-31 15:41:33 +02:00
Sebastiaan van Stijn
8b68b977b1 Revert "api/types/registry: EncodeAuthConfig: use empty string for zero value"
This reverts commit 3a447bc079.

Some daemon versions don't handle empty values well, which resulted in
an io.EOF error when sending an empty X-Registry-Auth during decoding
or unmarshaling.

We should investigate what code-paths are hit to trigger this, but
in the meantime, let's revert this patch.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-31 15:38:41 +02:00
Sebastiaan van Stijn
0a5fb23b35 Merge pull request #49264 from thaJeztah/jsonmessage_remove_deprecated
pkg/jsonmessage: stop printing deprecated progressDetail, errorDetail, remove DisplayJSONMessagesToStream and Stream interface
2025-07-31 02:24:24 +02:00
Sebastiaan van Stijn
494677f93f api/types/container: add aliases for go-connections/nat types
This allows us to update code to not be attached to go-connections
directly (in future we may be able to move the types to be concrete
types).

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-30 23:46:56 +02:00
Sebastiaan van Stijn
fdaccdb233 pkg/jsonmessage: stop printing deprecated progressDetail, errorDetail
The API still returns it for backward-compatibility (but probably
shouldn't), but we should no longer print it. This removes the
use of these fields for printing, but keeps them for streamformatter
to use.

- ErrorMessage was deprecated in 3043c26419
- ProgressMessage was deprecated in 597e0e69b4

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-30 22:51:13 +02:00
Sebastiaan van Stijn
7bb2a15294 Merge pull request #50565 from dmcgowan/move_jsonmessage
Move jsonmessage, streamformatter, and progress
2025-07-30 18:55:51 +02:00
Sebastiaan van Stijn
94ac102e4b api: remove deprecated NoBaseImageSpecifier
It was deprecated in 7b9bd987bf, but
won't be carried in the API module.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-30 15:00:59 +02:00
Derek McGowan
d00ecdc479 Move pkg/streamformatter to api/pkg/streamformatter
Signed-off-by: Derek McGowan <derek@mcg.dev>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-30 14:22:31 +02:00
Derek McGowan
66862e14d1 Move pkg/progress to api/pkg/progress
Signed-off-by: Derek McGowan <derek@mcg.dev>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-30 14:22:31 +02:00
Derek McGowan
1da417980c Move api/stdcopy to api/pkg/stdcopy
Signed-off-by: Derek McGowan <derek@mcg.dev>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-30 14:22:30 +02:00
Sebastiaan van Stijn
f4127d76c5 pkg/jsonmessage: move JSONProgress to api/types/jsonstream
Move the type to the API, but embed it, so that we keep the
methods on the struct in this package.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-30 14:22:30 +02:00
Sebastiaan van Stijn
0515e1c991 pkg/jsonmessage: move JSONError to api/types/jsonstream
Also rename api type JSONError to Error

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-07-30 14:22:27 +02:00
Sebastiaan van Stijn
2574c2b2e9 Merge pull request #50561 from thaJeztah/internalize_legacy_filter
api/types/filters: remove deprecated ToParamWithVersion
2025-07-29 14:50:42 +02:00
Sebastiaan van Stijn
6c7e2909c2 api/types/filters: remove deprecated ToParamWithVersion
It's only used by the client to support API versions older than v1.22.
Make it an internal utility that doesn't depend on internal fields of
`filter.Args`.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-29 13:04:39 +02:00
Derek McGowan
03d7f47f31 Update api go.mod
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-07-28 23:05:19 -07:00
Derek McGowan
d7cfe97984 Update logdriver to remove proto definitions
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-07-28 22:05:11 -07:00
Derek McGowan
86190e7366 Move swarm runtime plugin spec to swarm types
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-07-28 17:27:57 -07:00
Sebastiaan van Stijn
ec3e83a7b5 api/types/container: move StateStatus, NewStateStatus internal again
These types used to be internal to the container package, but were
moved to the API in 100102108b.

However, the `StateStatus` type is only used internally; it's used
as an intermediate type because [`container.State`] contains a sync.Mutex
field which would make copying it unsafe (see [moby@2998945]).

This moves the type and re-introduces an internal type
in the original location, effectively reverting
100102108b

[`container.State`]: 19e79906cb/container/state.go (L15-L23)
[moby@2998945]: 2998945a54

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-28 13:57:10 +02:00
Sebastiaan van Stijn
bc6851e5a1 Merge pull request #50521 from thaJeztah/move_StatsResponseReader
api/types/container.StatsResponseReader: move to client
2025-07-28 12:31:33 +02:00
Paweł Gronowski
79dd3b0fd3 Merge pull request #50537 from ndeloof/cli
cli/ is not in moby repo (anymore)
2025-07-28 08:49:33 +00:00
Nicolas De Loof
e6298db297 cli/ is not in moby repo (anymore)
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2025-07-28 10:01:58 +02:00
Sebastiaan van Stijn
83510a26b3 api/types: move backend types to daemon/server
The "backend" types in API were designed to decouple the API server
implementation from the daemon, or other parts of the code that
back the API server. This would allow the daemon to evolve (e.g.
functionality moved to different subsystems) without that impacting
the API server's implementation.

Now that the API server is no longer part of the API package (module),
there is no benefit to having it in the API module. The API server
may evolve (and require changes in the backend), which has no direct
relation with the API module (types, responses); the backend definition
is, however, coupled to the API server implementation.

It's worth noting that, while "technically" possible to use the API
server package, and implement an alternative backend implementation,
this has never been a prime objective. The backend definition was
never considered "stable", and we don't expect external users to
(attempt) to use it as such.

This patch moves the backend types to the daemon/server package,
so that they can evolve with the daemon and API server implementation
without that impacting the API module (which we intend to be stable,
following SemVer).

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-28 00:03:04 +02:00
Sebastiaan van Stijn
f67e6555bf api/types/container.StatsResponseReader: move to client
This type was only used in the client, and needs a rewrite; let's
move it to the client first.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-26 11:22:36 +02:00
Sebastiaan van Stijn
96a6884cb3 api/types: move DiskUsage types to api/types/system
Now that the types for the backend were moved to api/types/backend,
we can move the actual response-type and related options to
api/types/system.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-26 00:12:29 +02:00
Sebastiaan van Stijn
82c069c857 api/types/system: move DiskUsage, DiskUsageOptions to api/types/backend
These types were introduced in f07242f6d7,
but while their description mentions it's the type used for the
response, it actually isn't, and it's used by the backend, but
ultimately marshaled to the "types.DiskUsage" struct;

7dc46c6e0c/daemon/server/router/system/system_routes.go (L254-L270)

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-26 00:09:24 +02:00
Cory Snider
24aa86991c api/types: move PluginCreateOptions to client
While it is imported by both the client and the daemon, values of the
PluginCreateOptions struct are not marshaled or unmarshaled. The only
field is mapped to and from an HTTP query parameter. Furthermore, this
options type is the odd one out: the daemon uses types in
api/types/backend to pass options around for the other plugin lifecycle
operations. Move the PluginCreateOptions type into client, and define a
new PluginCreateConfig struct in api/types/backend for the daemon to use
alongside PluginRmConfig, PluginEnableConfig and PluginDisableConfig.

Signed-off-by: Cory Snider <csnider@mirantis.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-25 19:51:58 +02:00
Cory Snider
b93ad81898 api/types: move plugin client options into client
These types are only consumed by the client, not the daemon.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2025-07-25 19:51:58 +02:00
Cory Snider
44ae4cd2b7 api/types: move HijackedResponse into client
Signed-off-by: Cory Snider <csnider@mirantis.com>
2025-07-25 19:51:58 +02:00
Sebastiaan van Stijn
ef9ce55ccf Merge pull request #50491 from thaJeztah/move_api_docs
api: move docs to api module
2025-07-24 02:12:13 +02:00
Sebastiaan van Stijn
f1a97bda3d api/types/container: remove deprecated Stats type
This type was deprecated in ca06b222e3,
and is no longer used. Now that the API is in a new module, we can
remove the alias.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-23 18:36:21 +02:00
Sebastiaan van Stijn
4d5a7289a0 api: move docs to api module
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-23 17:44:18 +02:00
Sebastiaan van Stijn
f49224b352 Merge pull request #50482 from thaJeztah/container_execinspect
api/types/container: add missing type for exec-inspect response.
2025-07-23 13:55:51 +02:00
Cesar Talledo
fcc8209e12 Add support for multiple platforms in image export and loading.
Currently the image export and load APIs can be used to export or load all
platforms for the image, or a single specified platform.

This commit updates the API so that it accepts a list of platforms to export or
load, thereby giving clients the ability to export only selected platforms of an
image into a tar file, or load selected platforms from a tar file.

Unit and integration tests were updated accordingly.

As this requires a daemon API change, the API version was bumped.

Signed-off-by: Cesar Talledo <cesar.talledo@docker.com>
2025-07-23 01:31:36 +02:00
Sebastiaan van Stijn
2a342079c6 api/types/container: add missing type for exec-inspect response.
While the container package had a type for `ExecInspect`, this type only
contained the information currently used by the client, which was a subset
of the information returned by the API endpoint;

    curl --unix-socket /var/run/docker.sock http://localhost/v1.51/exec/2f8fc8b4b5003e9a58d97459e6561f2bf2d88bc059bc59c6633e7f765fb8d1e9/json | jq .
    {
      "ID": "2f8fc8b4b5003e9a58d97459e6561f2bf2d88bc059bc59c6633e7f765fb8d1e9",
      "Running": true,
      "ExitCode": null,
      "ProcessConfig": {
        "tty": true,
        "entrypoint": "bash",
        "arguments": [],
        "privileged": false
      },
      "OpenStdin": true,
      "OpenStderr": true,
      "OpenStdout": true,
      "CanRemove": false,
      "ContainerID": "8b7cd6b151613ccc20ebe9fc24d72cc7865b04c592848ab1415a80da9b315479",
      "DetachKeys": "EBE=",
      "Pid": 19964
    }

The API documentation for the endpoint documented the full response, but
we did not have a type for this, other than a type used by the backend.

This patch adds a type for the response. It currently aliases the backend
type to this type to preserve backward compatibility (and allow the API
module to be used in older branches). We can probably switch the backend
to use this type directly though (unless we want the backend to be
decoupled from the API response).

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-22 19:28:04 +02:00
Sebastiaan van Stijn
cc9e6a13a2 api/types/swarm/runtime: remove module path for generating proto
It only uses the last element of the import_path to be used as package
name (omitting it will pick the name of the `.proto`).

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-22 15:49:58 +02:00
Sebastiaan van Stijn
76c1afeb97 api/types/plugins/logdriver: remove module path for generating proto
It only uses the last element of the import_path to be used as package
name (omitting it will pick the name of the `.proto`).

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-22 15:49:57 +02:00
Sebastiaan van Stijn
85ecf8c0f4 api: update references to old module name
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-22 15:49:57 +02:00
Sebastiaan van Stijn
a17a2e8f3d api/stdcopy: touch-up godoc
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-22 15:49:57 +02:00