Commit Graph

41 Commits

Author SHA1 Message Date
Paweł Gronowski
71fd582aa2 modernize: Use strings.Builder instead of string concatenation
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-12-15 18:56:34 +01:00
Paweł Gronowski
62ed24a87c modernize: Use slices.Contains
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-12-15 18:56:34 +01:00
Paweł Gronowski
3df05205f4 modernize: Use range int
Added in Go 1.22

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-12-15 18:56:34 +01:00
Paweł Gronowski
cdce8f4f92 modernize: Use maps.Copy instead of for loops
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-12-15 18:56:33 +01:00
Paweł Gronowski
ff33808a79 modernize: Use strings.Cut instead of strings.Index where possible
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-12-15 18:56:33 +01:00
Paweł Gronowski
c9b0a21bb1 modernize: Use b.Loop (introduced in Go 1.24)
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-12-15 18:56:33 +01:00
Cory Snider
ae28867804 api/pkg/progress: move to client and daemon/internal
Move the progress package up into the client as a temporary shared location for
common clients like CLI and compose.

The progress package is used by the daemon to write progress updates to
some sink, typically a streamformatter. This package is of little use to
API clients as this package does not provide any facilities to consume
the progress updates.

Co-authored-by: Cory Snider <csnider@mirantis.com>
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-10-24 07:56:57 -05:00
Cory Snider
6baf274fa3 api/pkg/streamformatter: move to client and daemon/internal
Move the streamformatter package up into the client for a temporary
shared location between common clients like CLI and compose.

The streamformatter package is used by the daemon to write streams of
status and progress messages to API clients. It is completely out of
scope of the api module and not used outside the daemon. Remove the
unused rawSteamFormatter, whose purpose is to render the progress as a
TUI.

Co-authored-by: Cory Snider <csnider@mirantis.com>
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-10-24 07:56:51 -05:00
Austin Vazquez
c646091d57 api: move container port type to network package
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-10-03 17:30:42 -05:00
Cory Snider
fd4329a620 api/types/container: use netip types as appropriate
Signed-off-by: Cory Snider <csnider@mirantis.com>
2025-10-03 21:39:14 +02:00
Austin Vazquez
4279e522e1 Merge pull request #50710 from austinvazquez/define-network-port-types
api: add container network port types
2025-10-02 17:43:58 -07:00
Austin Vazquez
cb3abacc52 api/types/container: add network port and port range types
Co-authored-by: Sebastiaan van Stijn <github@gone.nl>
Co-authored-by: Cory Snider <csnider@mirantis.com>
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-10-02 13:59:34 -05:00
Sebastiaan van Stijn
544f8f53ed daemon/builder: use t.Context() in tests
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-25 21:15:02 +02:00
Sebastiaan van Stijn
fabe66322f builder/remotecontext: remove deprecated "Rel()" utility
This function was deprecated in 54a556a5ef,
and the package is now internal to the daemon, so we can remove it.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-12 09:59:09 +02:00
Sebastiaan van Stijn
2d1af4e4e4 api/types/build: move build options to client and backend
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-05 15:57:05 +02:00
Sebastiaan van Stijn
5232d82c1b daemon/server/backend: move build options to buildbackend
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-05 15:56:56 +02:00
Austin Vazquez
26e335b647 api/types/build: move CachePruneOptions to client mod
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-09-04 16:33:57 -05:00
Sebastiaan van Stijn
582ee7ea57 daemon/builder/dockerfile: copyRunConfig: use slices/maps.Clone
Simplify the code by replacing our DYI code to clone using
the slices and maps packages.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-09 14:58:06 +02:00
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
98790830eb Deprecate api/types/strslice.StrSlice and remove its use
The strslice.StrSlice type is a string-slice with a custom JSON Unmarshal
function to provide backward-compatibility with older API requests from
before docker 1.7 (see [moby@17d6f00] and [moby@ea4a067]), which used a
string instead of an array of strings for some fields (Cmd, Entrypoint).

We no longer support those API versions, and we no longer support pulling
v1 images that may contain such a config, so we can deprecate the type
and remove its use.

[moby@17d6f00]: 17d6f00ec2
[moby@ea4a067]: ea4a06740b

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-07 17:15:49 -05:00
Sebastiaan van Stijn
c145229828 update some fixtures in tests
updated TestModuleVersion fixture (looks like the test doesn't really care :D)

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-05 20:54:36 +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
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
Sebastiaan van Stijn
d58dc493fe replace direct uses of nat types for api/types/container aliases
Follow-up to 494677f93f, which added
the aliases, but did not yet replace our own use of the nat types.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-31 02:57:39 +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
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
5535e81a79 pkg/system: move to daemon/internal
It has no external users, and this package still has too many different
responsibilities, some of which may be available elsewhere, so moving it
internal so that we can decide to dismantle it further.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-29 11:48:57 +02:00
Sebastiaan van Stijn
4c1ab68c6c daemon/builder/remotecontext: remove detection of system.XattrError
Both locations checked an error from `filepath.Rel` in stdlib, which
would never return a `system.XattrError`, so this was just dead code.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-29 09:51:40 +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
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
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
222b2b8b2f Move internal/lazyregexp to daemon/internal/lazyregexp
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-07-24 12:12:38 -07:00
Derek McGowan
9566272f30 Move pkg/tarsum to daemon/builder/remotecontext/internal/tarsum
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-07-24 12:12:23 -07:00
Derek McGowan
c74ba95583 Move oci to daemon/pkg/oci
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-07-24 12:11:19 -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
fa9a3c383d Move layer to daemon/internal/layer
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-07-24 12:10:30 -07: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
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
Derek McGowan
af86e80825 Move daemon/build to daemon/builder/backend
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-07-16 15:06:15 -07: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