220 Commits

Author SHA1 Message Date
Matthieu MOREL
96f8c6395e chore: enable use-any rule from revive
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2025-08-08 17:07:07 +02:00
Sebastiaan van Stijn
c13266d2c0 api/types: move plugin types to api/types/plugin
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-05 15:42:57 +02:00
Sebastiaan van Stijn
c17d43ae67 api/types: move ErrorResponse to common/ErrorResponse
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-05 14:45:10 +02:00
Sebastiaan van Stijn
eda6a499e3 router/distribution: fetchManifest; detach from distributionRouter
The distributionRouter receiver was not used; make it a regular function
to make clear it doesn't require the router.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-01 16:41:17 +02:00
Sebastiaan van Stijn
cf15d5bbc6 remove obsolete //go:build tags
These are no longer needed as these are now part of a module.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-01 00:49:22 +02:00
Derek McGowan
f74e5d48b3 Create github.com/moby/moby/v2 module
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-07-31 10:13:29 -07: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
Derek McGowan
02fcde0c18 Add separate const for daemon httputils to avoid jsonmessage import
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-07-30 12:41:46 +02:00
Sebastiaan van Stijn
f78d595c96 runconfig: move to daemon/internal/runconfig
The runconfig package is used by the "container" router to unmarshal, normalize,
and validate a container.CreateRequest. The router converts the result to a
backend.ContainerCreateConfig to be passed on to the backend (daemon).

This package could possibly be part of the router itself, or moved to an
internal package in the server, but we don't have an internal package
there yet.

Put it in daemon/internal for now, which still leaves our options open.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-28 18:32:15 +02:00
Sebastiaan van Stijn
75bc4c5292 daemon/server/router/container: request sysInfo from daemon / backend
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-28 18:32:14 +02:00
Sebastiaan van Stijn
02867f9473 runconfig: rewrite ContainerDecoder to DecodeCreateRequest
Now that we no longer need the ContainerDecoder interface, we can
simplify this to just a function; effectively the ContainerDecoder
had three tasks;

- decode a container.CreateRequest
- validate the hostConfig
- split the container.CreateRequest to Config, HostConfig, and NetworkingConfig

Rewrite this to a DecodeCreateRequest function that returns
a DecodeCreateRequest.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-28 18:32:14 +02:00
Sebastiaan van Stijn
5e567a3856 daemon/server/httputils: remove ContainerDecoder interface
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-28 18:32:14 +02: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
26fda349b8 runconfig: remove exported errors
These errors were not used as sentinel error, and used as any other
"invalid parameter" / "invalid argument" error, so remove them, and
just produce errors where used.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-28 11:46:19 +02:00
Sebastiaan van Stijn
bf8b738ed5 Merge pull request #50458 from thaJeztah/commit_simplify
daemon/server/router/container: postCommit: only decode Config
2025-07-28 11:30:51 +02:00
Paweł Gronowski
2406d7bdb5 Merge pull request #50534 from thaJeztah/move_backend
api/types: move backend types to daemon/server
2025-07-28 08:42:53 +00: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
be27300c6e daemon/server/router/checkpoint: remove unused httputils.ContainerDecoder
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-27 15:19:50 +02:00
Sebastiaan van Stijn
b448dc5575 daemon/server/router/container: postCommit: only decode Config
The postCommit used the container-decoder from runconfig to unmarshal
the body. However, this function was written to decode a container
CreateRequest. Commit only accepts a container Config, so we can
just unmarshal to that type.

A local `commitRequest` type was added because the client posts a bare
`*container.Config` but it may be empty / nil (see [Client.ContainerCommit]
and [container.CommitOptions]), in which case it must be ignored, and no
overrides to be applied.

[Client.ContainerCommit]: c4afa77157/client/container_commit.go (L52)
[container.CommitOptions]: c4afa77157/api/types/container/options.go (L30)

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-27 14:38:18 +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
Sebastiaan van Stijn
ca1c5ee08f pkg/stringid: move to daemon, and provide copy in client
The stringid package is used in many places; while it's trivial
to implement a similar utility, let's just provide it as a utility
package in the client, removing the daemon-specific logic.

For integration tests, I opted to use the implementation in the
client, as those should not ideally not make assumptions about
the daemon implementation.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-25 13:39:32 +02:00
Derek McGowan
28de87fb28 Move internal/unix_noeintr to daemon/internal/unix_noeintr
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-07-24 12:15:34 -07:00
Derek McGowan
5b913b3ea0 Move internal/sliceutil to daemon/internal/sliceutil
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-07-24 12:15:19 -07:00
Derek McGowan
c3b0e0130a Move internal/otelutil to daemon/internal/otelutil
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-07-24 12:14:30 -07:00
Derek McGowan
f24455c90b Move image to daemon/internal/image
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-07-24 12:11:02 -07:00
Derek McGowan
1ff6011e04 Move distribution to daemon/internal/distribution
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-07-24 12:10:46 -07:00
Paweł Gronowski
f37c1c6abb Merge pull request #50404 from thaJeztah/saner_copy_defaults
daemon: ContainerExtractToDir: make AllowOverwriteDirWithFile opt-in
2025-07-24 12:35:25 +02:00
Sebastiaan van Stijn
bdcf4e8c85 adjust minimum API-version for multiple platforms on save/load
Follow-up to fcc8209e12, which didn't
make the window for API v1.51, so had to be adjusted for the API
version it requires.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-23 15:54:47 +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
b20888a707 Merge pull request #50281 from mdaffad/50253-add-container-health-on-containers-list-api
Add HealthStatus attribute on the docker ps command
2025-07-22 00:47:30 +02:00
Austin Vazquez
65ff636b39 Merge pull request #50455 from thaJeztah/daemon_noshadow
daemon/server: rename vars that shadowed imports
2025-07-21 15:05:20 -07:00
Muhammad Daffa Dinaya
6e7a2c830d Add Health attribute on the docker ps command
Signed-off-by: Muhammad Daffa Dinaya <muhammaddaffadinaya@gmail.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-21 22:57:03 +02:00
Sebastiaan van Stijn
20d594fb79 deprecate pkg/stdcopy, move to api/stdcopy
The stdcopy package is used to produce and read multiplexed streams for
"attach" and "logs". It is used both by the API server (to produce), and
the client (to read / de-multiplex).

Move it to the api package, so that it can be included in the api module.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-21 21:41:39 +02:00
Derek McGowan
afd6487b2e Create github.com/moby/moby/api module
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-07-21 09:30:05 -07:00
Sebastiaan van Stijn
842b631efe Merge pull request #50436 from thaJeztah/daemon_separate_version
daemon: define default (and maximum) API version
2025-07-21 17:07:50 +02:00
Sebastiaan van Stijn
c469e5ebab daemon/server: rename vars that shadowed imports
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-21 15:30:19 +02:00
Austin Vazquez
f776cd6922 Merge pull request #50367 from dmcgowan/move-volume-daemon
Move volume under daemon
2025-07-17 14:21:06 -07:00
Sebastiaan van Stijn
7b9bd987bf api: deprecate NoBaseImageSpecifier
This const is no longer used and will be removed in the next release.

Also fixed a var that shadowed a type.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-17 15:43:08 +02:00
Sebastiaan van Stijn
a632b8495b daemon: define default (and maximum) API version
With the daemon and API migrating to separate modules, users of the daemon
module may upgrade the API module to higher versions. Currently, the daemon
uses the API's Default version. While the version of the API module is
allowed to be updated (following SemVer), we should not allow the Daemon
to support higher API versions than it was written for.

This patch introduces a DefaultAPIVersion in the daemon/config package that is
used as default version of the API for the daemon to use.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-17 14:35:05 +02:00
Derek McGowan
7d48302134 Move builder to daemon/builder
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-07-16 15:06:00 -07:00
Derek McGowan
04f5276267 Move volume to daemon/volume
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-07-15 10:44:44 -07:00
Derek McGowan
7a720df61f Move libnetwork to daemon/libnetwork
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-07-14 09:25:23 -07:00
Sebastiaan van Stijn
9bcb12aa48 daemon: ContainerExtractToDir: make AllowOverwriteDirWithFile opt-in
This change changes the default for noOverwriteDirNonDir to be true
internally, with the intent to change the default at the API to follow
accordingly.

The `AllowOverwriteDirWithFile` option in the Client was added when
reimplementing the CLI using the API Client lib in [moby@1b2b91b].
Before that refactor, the `noOverwriteDirNonDir` query argument
[would be set unconditionally][1] by the CLI, with no options to
control the behavior.

The `noOverwriteDirNonDir` query parameter was added in [moby@db9cc91] to
set the `NoOverwriteDirNonDir` option that was implemented in pkg/archive
in [moby@a74799b].

It was added in [PR13171-comment2], following a discussion on the risk
of replacing a directory with a file and vice-versa in [PR13171-comment].

> In my latest changes from yesterday:
>
> - Removed the `GET stat-path` endpoint and added a `HEAD` handler to
>   the `archive-path` endpoint. Updated the api docs to reflect this.
>   Also moved api docs changes from `v1.19` to `v1.20`.
> - Added a `NoOverwriteDirNonDir` flag to `archive.TarOptions` to indicate
>   that we do not want to overwrite a directory with a non-directory (and
>   vice versa) when unpacking an archive.
> - Added a corresponding but optional `noOverwriteDirNonDir` parameter
>   to the `PUT extract-to-dir` endpoint to specify desired behavior.
>
> These changes combine to keep the behavior we want

It's unclear why these were added as an *option* and why it was implemented
as opt-in (not opt-out), as overwriting a file with a directory (or vice-versa)
would generally be unexpected behavior.

[1]: 8c9ad7b818/api/client/cp.go (L345-L346)
[moby@1b2b91b]: 1b2b91ba43
[moby@a74799b]: a74799b701
[moby@db9cc91]: db9cc91a9e
[PR13171-comment]: https://github.com/moby/moby/pull/13171#issuecomment-106559765
[PR13171-comment2]: https://github.com/moby/moby/pull/13171#issuecomment-108538643

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-13 16:37:36 +02:00
Sebastiaan van Stijn
9caa11d3c2 Merge pull request #50370 from thaJeztah/auth_unused_return
daemon: AuthenticateToRegistry: remove statusMessage return
2025-07-11 20:58:36 +02:00
Sebastiaan van Stijn
ea29dffaa5 daemon/server: remove compatibility with API v1.4 auth-config on push
Docker [API v1.4] and lower expected registry authentication to be sent in
the request body when pushing or pulling ("creating") images. [API v1.5]
(Docker v0.6.1) changed this to this to use a `X-Registry-Auth` header
instead.

This change was implemented in d04beb7f43,
which kept a fallback for clients using old (< v1.5) API versions which
would send authentication in the request body.

Given that we no longer support API versions older than v1.24, and clients
using API v1.5 would be over 12 Years old.

[API v1.4]: https://github.com/moby/moby/blob/v0.6.1/docs/sources/api/docker_remote_api_v1.4.rst#push-an-image-on-the-registry
[API v1.5]: https://github.com/moby/moby/blob/v0.6.2/docs/sources/api/docker_remote_api_v1.5.rst#push-an-image-on-the-registry

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-10 18:35:11 +02:00
Sebastiaan van Stijn
54e67d0054 daemon: AuthenticateToRegistry: remove statusMessage return
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-10 14:55:28 +02:00