Compare commits

...

970 Commits

Author SHA1 Message Date
copilot-swe-agent[bot]
bda984d120 Remove deprecated keep-storage parameter from /build/prune API
- Remove keep-storage parameter from swagger.yaml API specification
- Remove KeepStorage field from CachePruneOptions struct
- Remove client-side logic for setting keep-storage query parameter
- Remove server-side fallback logic for keep-storage in API v1.49+
- Remove backward compatibility logic in builder.go
- Add comprehensive tests to validate keep-storage is no longer sent
- Maintain backward compatibility for API versions < v1.49

Co-authored-by: vvoland <5046555+vvoland@users.noreply.github.com>
2025-08-14 13:00:36 +00:00
copilot-swe-agent[bot]
56b3c83168 Initial plan 2025-08-14 12:46:36 +00:00
Paweł Gronowski
9bf1d7e2a6 Merge pull request #50728 from vvoland/gha-changelog-kind
.github/workflows: Add kind label validation to PR workflow
2025-08-14 13:37:37 +02:00
Paweł Gronowski
97587945ef .github/workflows: Add kind label validation to PR workflow
The PR validation workflow now enforces that every PR with an 'impact/*'
label must also have a corresponding 'kind/*' label, in addition to the
existing 'area/*' label requirement.

This change helps ensure proper categorization of pull requests by
requiring contributors to specify both the impact area and the kind of
change being made.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-08-14 12:47:03 +02:00
Austin Vazquez
98286b9cd8 Merge pull request #50711 from thaJeztah/rename_port
api/types/container: rename Port to PortSummary
2025-08-13 12:50:23 -07:00
Sebastiaan van Stijn
82ba7fef17 api/types/container: rename Port to PortMapping
It better describes its purpose, and allows "Port" to be used for
other purposes (e.g. to replace "nat.Port").

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Co-authored-by: Austin Vazquez <austin.vazquez@docker.com>
2025-08-13 12:55:31 -05:00
Sebastiaan van Stijn
e5f2023861 Merge pull request #50712 from thaJeztah/filter_simplify
daemon: don't strong-type filters
2025-08-13 17:13:33 +02:00
Sebastiaan van Stijn
32f3579ecf Merge pull request #50709 from thaJeztah/client_ping_err_fixes
client: Client.Ping: improve error handling and fallback, and assorted fixes/cleanups
2025-08-13 17:12:51 +02:00
Austin Vazquez
c70f205ed0 Merge pull request #50713 from thaJeztah/bump_bbolt
vendor: go.etcd.io/bbolt v1.4.2
2025-08-13 06:50:03 -07:00
Sebastiaan van Stijn
606519a171 Merge pull request #50708 from austinvazquez/restore-docker-driver-env-var
Restore DOCKER_DRIVER environment variable
2025-08-13 14:11:26 +02:00
Sebastiaan van Stijn
2aba802ae6 daemon: don't strong-type filters
The input is a string, and we're producing an error if those strings
are in the wrong format, so we may as well just use a map[string]bool

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-13 13:57:06 +02:00
Sebastiaan van Stijn
a2aa7be724 vendor: go.etcd.io/bbolt v1.4.2
- Fix the compilation issue on aix, android and solaris due to wrong use of maxMapSize
- Add protection on meta page when it's being written
- Correct the incorrect usage of debug method
- Add clarification on the option InitialMmapSize
- Fix the crash when writing huge values

full diff: https://github.com/etcd-io/bbolt/compare/v1.4.0...v1.4.2

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-13 13:45:05 +02:00
Sebastiaan van Stijn
1c34ff94bc client: consistently use defer for ensureReaderClosed
ensureReaderClosed was designed to be usable regardless if a response
was nil (error) or non-nil (success). Some code-paths were optimized to
avoid using a defer (which used to have an overhead), but the overhead
of defer is neglectable in current versions of Go, and some of these
optimizations made the logic more complicated (and err-prone).

This patch switches to use a defer for all places.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-13 01:17:32 +02:00
Sebastiaan van Stijn
f6b63e6013 client.sendRequest: clean-up logic for error-handling
Only use checkResponseErr if `client.doRequest` did not return an error;
any error returned by `client.doRequest` means there was an error connecting,
so there's no response to handle (including errors in the response).

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-12 23:58:48 +02:00
Sebastiaan van Stijn
2a4f70309d client.doRequest: improve GoDoc to clarify behavior
Outline that any error returned is a connectivity error and a nil-error
requires the response to be handled (including errors returned in the
response).

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-12 23:58:48 +02:00
Sebastiaan van Stijn
d69fde4c60 client: Client.Ping: improve error handling and fallback
The Ping function first tries to do a HEAD request, but the parsePingResponse
was written with the assumption that a Body could be present in the response
that may include errors returned by the API server.

HEAD responses don't include a body, so there's no response to handle, and
no errors to return by the API, other than a HTTP status code.

This patch:

- Rewrites `parsePingResponse` to a `newPingResponse`, removing the error-
  handling for the response-body. It's also simplified, because a non-nil
  response is guaranteed to have a non-nil Header (but it may not have
  any of the headers set that are used for the Ping).
- Rewrites the `Client.Ping` to only return a Ping-response from the HEAD
  request if no error was returned (i.e., we connected with the API) and
  a successful status-code, otherwise it will fallback to a GET request,
  which allows (for non "OK" (200) status-codes) returning errors from
  the daemon (for example, if the daemon is in an unhealthy state).

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-12 23:58:40 +02:00
Austin Vazquez
b2e6fd31cf Restore DOCKER_DRIVER environment variable for storage driver configuration.
This change restores the environment variable configuration of daemon storage driver through the DOCKER_DRIVER environment variable.

Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-08-12 16:35:31 -05:00
Sebastiaan van Stijn
80294ddb60 client: make checkResponseErr a regular function
It was implemented as a method on Client, but the receiver was not used;
make it a regular function to prevent passing around the Client where
not needed.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-12 21:49:24 +02:00
Cory Snider
a27a2901b1 Merge pull request #50660 from corhere/libn/overlay-eventnotify-nilderef
libn/d/overlay: don't deref nil PeerRecord on error
2025-08-12 11:51:44 -04:00
Austin Vazquez
cd8e84a058 Merge pull request #50705 from thaJeztah/more_modernize
daemon: use slices.Clone, maps.Collect in some places
2025-08-12 05:05:05 -07:00
Sebastiaan van Stijn
f17f9230c9 Merge pull request #50686 from thaJeztah/libnet_less_copyto
daemon/libnetwork: refactor, modernize various `CopyTo` functions, remove redundant utilities
2025-08-12 12:45:54 +02:00
Sebastiaan van Stijn
423980614e daemon: use slices.Clone, maps.Collect in some places
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-12 12:08:12 +02:00
Sebastiaan van Stijn
6505e8d605 daemon/libnetwork/types: rename StaticRoute.GetCopy to Copy
Just for consistency; it was the last `GetCopy` remaining.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-12 11:48:24 +02:00
Sebastiaan van Stijn
1e11e64c9c daemon/libnetwork/types: remove TransportPort.Equal()
The `TransporPort` type is comparable; it doesn't have fields that
require special handling. It's defined as;

    // TransportPort represents a local Layer 4 endpoint
    type TransportPort struct {
        Proto Protocol
        Port  uint16
    }

where `Protocol` is an int (with a stringer interface);

    type Protocol uint8

So we can remove the `Equal` method, and simplify places where it's
compared.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-12 11:39:56 +02:00
Sebastiaan van Stijn
561e14ea3f daemon/libnetwork/types: remove TransportPort.GetCopy()
The `GetCopy()` function doesn't de-reference anything, as it's
all a straight copy. We can remove it as it's only making things
more complicated than needed.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-12 11:39:56 +02:00
Sebastiaan van Stijn
385297ee40 daemon/libnetwork/types: remove unused IsIPNetValid utility
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-12 11:39:55 +02:00
Sebastiaan van Stijn
7960f742a2 daemon/libnetwork: Endpoint.CopyTo: use maps/slices.Clone
Modernize using maps.Clone, slices.Clone. This method is needed to
satisfy the datastore.KVObject interface, so also assert it does.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-12 11:39:55 +02:00
Sebastiaan van Stijn
a82a68a445 daemon/libnetwork: replace endpointJoinInfo.CopyTo with Copy()
The endpointJoinInfo.CopyTo function expected the caller to construct an
EndpointInterface to copy to, but all callsites created an empty struct.
In addition, `CopyTo` would never return an error, so the error return
was redundant.

Replace it with a `Copy()` function, which makes it easier to
consume.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-12 11:39:55 +02:00
Sebastiaan van Stijn
2d5100749d daemon/libnetwork: replace EndpointInterface.CopyTo with Copy()
The EndpointInterface.CopyTo function expected the caller to construct an
EndpointInterface to copy to, but all callsites created an empty struct.
In addition, `CopyTo` would never return an error, so the error return
was redundant.

Replace it with a `Copy()` function, which makes it easier to
consume.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-12 11:39:48 +02:00
Sebastiaan van Stijn
80452e5d4a daemon/libnetwork/types: PortBinding.Equal: use non-pointer receiver
Change `PortBinding.Equal` to use a value receiver and parameter, this
allows us to use it directly with `slices.IndexFunc`, `DeleteFunc`,
without having to add a wrapper func.

The only exception currently is the `UnmapPorts` function (stub), which
takes portmapperapi.PortBinding as argument; the portmapperapi.PortBinding
type embeds `types.PortBinding`, and it's the only field that's compared
as part of `UnmapPorts`

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-12 11:38:09 +02:00
Sebastiaan van Stijn
7d5312ab56 daemon/libnetwork/types: rename PortBinding.GetCopy to Copy and non-pointer
- Rename `PortBinding.GetCopy()` to `PortBinding.Copy()`, which is more
  idiomatic, and aligns with other similar methods.
- Change it to a non-pointer receiver; `Copy` does not mutate state, and
  the type should still be reasonably small.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-12 11:38:09 +02:00
Sebastiaan van Stijn
e387dc977e daemon/libnetwork/types: cleanup GetIPNetCopy, GetIPNetCanonical
Rewrite both to use slices.Clone, and GetIPNetCanonical to not depend
on GetIPNetCopy. GetIPNetCopy only has a single consumer, so we should
consider moving it local to where it's used.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-12 11:38:09 +02:00
Sebastiaan van Stijn
68a94ecbb5 daemon/libnetwork/types: remove GetIPCopy; use slices.Clone
We can replace this utility with slices.Clone, which provides the
same functionality.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-12 11:38:09 +02:00
Sebastiaan van Stijn
115b801a3b daemon/libnetwork/types: remove GetMacCopy; use slices.Clone
We can replace this utility with slices.Clone, which provides the
same functionality.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-12 11:38:09 +02:00
Sebastiaan van Stijn
cfad3ed6b9 daemon/libnetwork: replace IpamInfo.CopyTo with IpamInfo.Copy()
The IpamInfo.CopyTo function expected the caller to construct an
IpamInfo to copy to, but all callsites created an empty struct.
In addition, `CopyTo` would never return an error, so the error
return was redundant.

Replace it with a `Copy()` function, which makes it easier to
consume.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-12 11:38:09 +02:00
Sebastiaan van Stijn
2f74f245b6 daemon/libnetwork: replace IpamConf.CopyTo with IpamConf.Copy()
The IpamConf.CopyTo function expected the caller to construct an
IpamConf to copy to, but all callsites created an empty struct.
In addition, `CopyTo` would never return an error, so the error
return was redundant.

Replace it with a `Copy()` function, which makes it easier to
consume.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-12 11:38:08 +02:00
Sebastiaan van Stijn
82ea65ea2f Merge pull request #50703 from thaJeztah/libnet_fix_delete
daemon/libnet/drv/bridge: stubPortMapper.UnmapPorts: fix slices.Delete
2025-08-12 11:34:59 +02:00
Sebastiaan van Stijn
796a4ce952 daemon/libnet/drv/bridge: stubPortMapper.UnmapPorts: fix slices.Delete
This stub was introduced in 4e246efcd1,
which currently is only in the master branch.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-12 09:27:29 +02:00
Sebastiaan van Stijn
16f2e81369 Merge pull request #50679 from hannesortmeier/50676-swagger-forceupdate-uint64
api: swagger: Tweak type of ForceUpdate to uint64
2025-08-11 23:18:45 +02:00
Austin Vazquez
0ca1bc036f Merge pull request #48009 from dmcgowan/containerd-migration
Update containerd to default storage and add support for migration
2025-08-11 13:33:14 -07:00
Sebastiaan van Stijn
162e6fae53 Merge pull request #50688 from thaJeztah/remove_errdefs_aliases
daemon/libnetwork/types: remove errdefs aliases
2025-08-11 19:01:55 +02:00
Paweł Gronowski
7f9c5069e6 Merge pull request #50690 from thaJeztah/ep_copy_step1
api/types/network: modernize EndpointIPAMConfig.Copy, EndpointSettings.Copy
2025-08-11 16:50:40 +00:00
Sebastiaan van Stijn
79ca608d15 Merge pull request #50685 from thaJeztah/windows_cleanup_err
daemon/libnet/drivers/windows: small cleanup in error-handling
2025-08-11 17:53:27 +02:00
Sebastiaan van Stijn
5f29ca9657 Merge pull request #50683 from thaJeztah/ContainerInspect_clean
daemon: Daemon.ContainerInspect: move vars closer to where used
2025-08-11 17:48:08 +02:00
Sebastiaan van Stijn
f694d98800 Merge pull request #50682 from thaJeztah/dockerfile_copyRunConfig_simplify
daemon/builder/dockerfile: copyRunConfig: use slices/maps.Clone
2025-08-11 17:47:40 +02:00
Derek McGowan
a4fbbc1570 Add context to restore and load containers
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-08-11 08:47:24 -07:00
Derek McGowan
85b79f83f4 Fix hardlink handling in containerd snapshot remap
When files are hardlinked, the inodes only need to be chowned once.

Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-08-11 08:47:23 -07:00
Derek McGowan
ead007f1f1 Use native snapshotter for integration tests and run
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-08-11 08:47:23 -07:00
Derek McGowan
99181f56ce Fix symlink evaluation to a directory that may not exist
During the arm64 tests, the rootfs directory does not seem to exist when
this test is run and will cause a failure when using snapshotter.

Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-08-11 08:47:23 -07:00
Derek McGowan
4816383c0b Add environment variable to define the threshold
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-08-11 08:47:22 -07:00
Hannes Ortmeier
185ae7ec2c docs: api: Tweak type of ForceUpdate to uin64
Signed-off-by: Hannes Ortmeier <ortmeier.hannes@gmail.com>
2025-08-11 17:29:04 +02:00
Hannes Ortmeier
c8173c5c1f api: swagger: Tweak type of ForceUpdate to uint64
Signed-off-by: Hannes Ortmeier <ortmeier.hannes@gmail.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-11 17:28:58 +02:00
Rob Murray
2d0bc97eb9 Merge pull request #50646 from robmry/nftables_no_enable_ip_forwarding
nftables: never enable IP forwarding on the host
2025-08-11 09:44:00 +01:00
Sebastiaan van Stijn
0a89d98bad daemon/libnetwork/types: remove errdefs aliases
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-10 20:18:02 +02:00
Sebastiaan van Stijn
892ebd2f17 daemon/libnet/drivers/windows: small cleanup in error-handling
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-10 16:43:36 +02:00
Sebastiaan van Stijn
11094e27b0 api/types/network: modernize EndpointIPAMConfig.Copy, EndpointSettings.Copy
- Use slices.Clone where suitable.
- Handle `nil` values so that callers don't have to check for `nil`.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-10 12:59:21 +02:00
Sebastiaan van Stijn
b48df69b02 daemon: Daemon.ContainerInspect: move vars closer to where used
- construct the `ports` copy before `networkSettings` so that it
  can be used as part of the struct-literal. This copy was added
  in 7917a36cc7 to prevent a race-
  condition.
- `mountPoints` is not used until the very end, but (likely) still
  needs to happen while we hold the lock, so move it before it's
  released.
- add a comment referencing the reason to unlock early before the
  size calculation, in case it become irrelevant in future.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-10 12:18:34 +02: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
Sebastiaan van Stijn
feeaa167ea Merge pull request #50677 from thaJeztah/dep_bumps
vendor: update some (indirect) dependencies
2025-08-08 23:29:54 +02:00
Sebastiaan van Stijn
c6ea52196c Merge pull request #50546 from slonopotamus/windows-runtimes
Fix custom runtimes handling on Windows
2025-08-08 22:54:29 +02:00
Marat Radchenko
0ded8645b6 Fix custom runtimes handling on Windows
This commit partially reverts 7ccf750daa and 84965c0752

Closes #50542

Signed-off-by: Marat Radchenko <marat@slonopotamus.org>
2025-08-08 21:41:17 +02:00
Sebastiaan van Stijn
aa6838ae54 vendor: go.uber.org/zap v1.27.0
Removes dependency on benbjohnson/clock, github.com/pkg/errors,
and go.uber.org/atomic (in favor of stdlib).

full diff: https://github.com/uber-go/zap/compare/v1.21.0...v1.27.0

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-08 21:34:32 +02:00
Sebastiaan van Stijn
daf843b72f vendor: go.uber.org/multierr v1.11.0
- Drop external atomic dependency
- Support Go 1.20 Unwrap() []error

full diff: https://github.com/uber-go/multierr/compare/v1.9.0...v1.11.0

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-08 21:25:05 +02:00
Sebastiaan van Stijn
aa85a44139 vendor: github.com/google/btree v1.1.3
- fix: remove item may changed clone btree; (i+1) children has new cow, but do not copy

full diff: https://github.com/google/btree/compare/v1.1.2...v1.1.3

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-08 21:21:21 +02:00
Sebastiaan van Stijn
fe32e4a999 vendor: github.com/golang/groupcache v0.0.0-20241129210726-2c02b8208cf8
- groupcache: add go.mod, update for Go 1.24

full diff: 41bb18bfe9...2c02b8208c

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-08 21:13:47 +02:00
Sebastiaan van Stijn
76fc74317a vendor: github.com/golang/gddo v0.0.0-20190904175337-72a348e765d2
Repository has been archived, and we only use a single package, so we
could even consider forking. For now, let's at least update it to the
latest code, which added a go.mod.

full diff: 72a348e765...20d68f94ee

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-08 21:10:46 +02:00
Derek McGowan
632fb0c89a Update graphdriver check logic to account for disabling of snapshotter
Ensure migration is never attempted multiple times.

Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-08-08 12:07:42 -07:00
Derek McGowan
b41babafaa Fix windows test graphdriver setting
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-08-08 12:07:42 -07:00
Derek McGowan
8700bca2bf Update migration test to use graphdriver env
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-08-08 12:07:42 -07:00
Derek McGowan
00463b9216 Fix containerd image count
Ensure image count returned by containerd image service only includes
the count of unique images.

Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-08-08 12:07:41 -07:00
Derek McGowan
7f87cf9d8a Check for snapshotter plugin availability
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-08-08 12:07:41 -07:00
Derek McGowan
632de98f75 Enable containerd snapshotters by default
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-08-08 12:07:41 -07:00
Derek McGowan
9f5f4f5a42 Add containerd migration to daemon startup
Add layer migration on startup
Use image size threshold rather than image count
Add daemon integration test
Add test for migrating to containerd snapshotters
Add vfs migration
Add tar export for containerd migration
Add containerd migration test with save and load

Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-08-08 12:07:23 -07:00
Rob Murray
4b97831992 Merge pull request #50671 from mmorel-35/github.com/hashicorp/go-multierror
chore: use errors.Join instead of github.com/hashicorp/go-multierror
2025-08-08 19:40:36 +01:00
Rob Murray
2fff6b442e check-config.sh: report IP forwarding sysctl state
Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-08-08 18:43:35 +01:00
Rob Murray
f71e86eed5 rootless: enable IP forwarding
Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-08-08 18:43:35 +01:00
Rob Murray
f802d8a08e When cleaning iptables rules, warn on filter-FORWARD DROP
Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-08-08 18:43:35 +01:00
Rob Murray
67ffa47090 nftables: don't enable IP forwarding
For nftables only, never enable IP forwarding on the host. Instead,
return an error on network creation if forwarding is not enabled,
required by a bridge network, and --ip-forward=true.

If IPv4 forwarding is not enabled when the daemon is started with
nftables enabled and other config at defaults, the daemon will
exit when it tries to create the default bridge.

Otherwise, network creation will fail with an error if IPv4/IPv6
forwarding is not enabled when a network is created with IPv4/IPv6.

It's the user's responsibility to configure and secure their host
when they run Docker with nftables.

Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-08-08 18:43:35 +01:00
Rob Murray
7dfeee8460 Drop FirewallCleanerSetter interface
Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-08-08 18:43:35 +01:00
Rob Murray
200a75b34a Return concrete types from NewNftabler/NewIptabler
Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-08-08 18:43:35 +01:00
Sebastiaan van Stijn
9d167847d0 Merge pull request #50654 from thaJeztah/fix_fakestorage
testutil/fakestorage: use local paths, fix port-mapping and optimize, and remove contrib/httpserver
2025-08-08 19:26:42 +02:00
Matthieu MOREL
050fbbccca chore: use errors.Join instead of github.com/hashicorp/go-multierror
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2025-08-08 19:19:21 +02:00
Sebastiaan van Stijn
90eef3f0c9 Merge pull request #50672 from mmorel-35/revive-use-any
chore: enable use-any rule from revive
2025-08-08 18:00:49 +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
0b1b5bf13d Merge pull request #50667 from thaJeztah/no_more_closing
check for net.ErrClosed instead of "use of closed network connection"
2025-08-08 17:03:05 +02:00
Albin Kerouanton
5cb7e19528 Merge pull request #50669 from akerouanton/dont-reuseaddr-for-UDP
libnet/pa: don't set SO_REUSEADDR on UDP sockets
2025-08-08 15:31:09 +02:00
Sebastiaan van Stijn
846cf4b56b Merge pull request #50292 from thaJeztah/deprecate_strslice
Deprecate api/types/strslice.StrSlice and remove its use
2025-08-08 14:43:17 +02:00
Albin Kerouanton
c6be4ad999 libnet/pa: don't set SO_REUSEADDR on UDP sockets
The userland proxy uses unconnected UDP sockets to receive packets from
anywhere, so enabling SO_REUSEADDR means that multiple sockets can bind
the same port. This defeats the purpose of the portallocator, which is
supposed to ensure that the port is free and not already in use (either
by us, or by another process). So, do not enable SO_REUSEADDR for UDP
sockets.

Signed-off-by: Albin Kerouanton <albinker@gmail.com>
2025-08-08 13:46:04 +02:00
Sebastiaan van Stijn
3862a0875c check for net.ErrClosed instead of "use of closed network connection"
The infamous "use of closed network connection" error was added in
[cl-5649076] as a non-exported error. This made it not possible to
write code to handle it as a sentinel error, other than through string-
matching.

Commit [moby@cc851db] (docker v0.6.4) added a [`IsClosedError`] utility
for this (as [net.errClosing@go1.1.2] did not yet export this error).
The `IsClosedError` was later moved to the `go-connections` module, but
various other places in our code used similar matching.

There was a feature-request [go-4373] to export it, which
got accepted and implemented in [CL 5649076], so starting with go1.16
we now have [net.ErrClosed@go1.16], so can remove the string matching.

[CL 5649076]: https://golang.org/cl/5649076
[moby@cc851db]: cc851dbb3f
[`IsClosedError`]: cc851dbb3f/utils/utils.go (L1032-L1040)
[net.errClosing@go1.1.2]: https://github.com/golang/go/blob/go1.1.2/src/pkg/net/net.go#L341
[go-4373]: https://github.com/golang/go/issues/4373
[net.ErrClosed@go1.16]: https://github.com/golang/go/blob/go1.16/src/net/net.go#L636-L645

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-08 09:58:06 +02:00
Sebastiaan van Stijn
5a30aa3670 Merge pull request #50665 from thaJeztah/update_badges
README: update, add badges
2025-08-08 08:54:42 +02:00
Sebastiaan van Stijn
3db66944ad Merge pull request #50657 from randomnoise/docs-rm-branch-name-image-tag-refs
docs/contributing: remove GIT_BRANCH image tag references
2025-08-08 08:46:47 +02:00
Sebastiaan van Stijn
0fbb6a244a Merge pull request #50650 from ctalledo/fix-for-50531
Stabilize TestSaveAndLoadPlatform integration test.
2025-08-08 08:46:10 +02:00
Sebastiaan van Stijn
e1be10f5ed Merge pull request #50647 from thaJeztah/rm_vendor.mod
remove references to "vendor.mod"
2025-08-08 03:12:14 +02:00
Sebastiaan van Stijn
59711b3245 Merge pull request #50653 from austinvazquez/bump-go-1.24.6
update to go1.24.6
2025-08-08 02:21:56 +02:00
Serhan Tutar
9cae3fb167 docs/contributing: remove GIT_BRANCH image tag references
When creating development containers currently, `Makefile` doesn't use
the GIT_BRANCH variable to tag `docker-dev` image. But in some
documentation files for contributing, references remain for image tags
with the `git branch` name.

This commit simply removes those references. Correct image tag names are
important for newcomers, especially for copy-pasteable commands.

Related PR: 42652

Signed-off-by: Serhan Tutar <randomnoise@users.noreply.github.com>
2025-08-08 02:01:41 +02:00
Cesar Talledo
04d95003fd Stabilize TestSaveAndLoadPlatform integration test.
Test was flaky because it was not waiting for an image load
operation to complete before proceeding to check if the load
succeeded. Fix this.

Signed-off-by: Cesar Talledo <cesar.talledo@docker.com>
2025-08-08 01:57:53 +02:00
Sebastiaan van Stijn
1f323d5035 client: README: add badges
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-08 01:16:53 +02:00
Sebastiaan van Stijn
662154a940 api: README: add badges
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-08 01:16:30 +02:00
Sebastiaan van Stijn
b4e353c02b README: add license and OpenSSF badge
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-08 01:14:33 +02:00
Sebastiaan van Stijn
df3aea43aa remove references to "vendor.mod"
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-08 00:24:37 +02:00
Austin Vazquez
33badcff70 Merge pull request #50126 from thaJeztah/bump_go_connections
vendor: github.com/docker/go-connections v0.6.0
2025-08-07 15:18:41 -07: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
Austin Vazquez
b25b421f97 update to go1.24.6
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-08-07 17:14:22 -05:00
Sebastiaan van Stijn
a328be30eb Merge pull request #50645 from thaJeztah/bump_c8d
Dockerfile: update containerd binary to v1.7.28
2025-08-07 23:49:00 +02:00
Sebastiaan van Stijn
677c2a19d9 vendor: github.com/docker/go-connections v0.6.0
- deprecate sockets.GetProxyEnv, sockets.DialerFromEnvironment
- add support for unix sockets on Windows
- remove legacy CBC cipher suites from client config
- align client and server defaults to be the same.
- remove support for encrypted TLS private keys.
- nat: optimize ParsePortSpec

full diff: https://github.com/docker/go-connections/compare/v0.5.0...v0.6.0

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-07 22:07:57 +02:00
Sebastiaan van Stijn
50789e2bab testutil/fakestorage: inline go code and remove contrib/httpserver
It's 12 lines of code total; we may as well write it as part of building;
it looks to be the only place this is used, so we can remove the contrib
directory, which should not be used by anyone.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-07 22:04:09 +02:00
Sebastiaan van Stijn
d49a354cb2 testutil/fakestorage: use local paths, fix port-mapping and optimize
- always build the go binary, instead of trying to find if it exists
  and then trying to copy it.
- write the Dockerfile ourselves, instead of trying to copy the one
  from contrib.
- update the Dockerfile to be built "FROM scratch"; we don't need
  busybox here.
- start the container with "PublishAllPorts: true", otherwise no
  ports would be mapped.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-07 22:04:09 +02:00
Sebastiaan van Stijn
8be1b2372a Dockerfile: update containerd binary to v1.7.28
- release notes: https://github.com/containerd/containerd/releases/tag/v1.7.28
- full diff: https://github.com/containerd/containerd/v1.7.27...v1.7.28

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-07 22:03:38 +02:00
Sebastiaan van Stijn
0ea918ad0a Merge pull request #50662 from vvoland/fix-frozen
Fix download-frozen-image-v2
2025-08-07 21:58:57 +02:00
Paweł Gronowski
b9b52d59b8 download-frozen-image-v2: Use curl -L
Passing the Auth to the redirected location was fixed in curl 7.58:
https://curl.se/changes.html#7_58_0 so we no longer need the extra
handling and can just use `-L` to let curl handle redirects.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-08-07 20:52:30 +02:00
Paweł Gronowski
359a881cea download-frozen-image-v2: handle 307 responses without decimal
Correctly parse HTTP response that doesn't contain an HTTP version with a decimal place:

```
< HTTP/2 307
```

The previous version would only match strings like `HTTP/2.0 307`.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-08-07 20:51:42 +02:00
Cory Snider
12c6345d3a libn/d/overlay: don't deref nil PeerRecord on error
If unmarshaling the peer record fails, there is no need to check if it's
a record for a local peer. Attempting to do so anyway will result in a
nil-dereference panic. Don't do that.

The Windows overlay driver has a typo: prevPeer is being checked twice
for whether it was a local-peer record. Check prevPeer once and newPeer
once each, as intended.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2025-08-07 13:25:37 -04:00
Rob Murray
e628fa0409 Merge pull request #50649 from olljanat/win-keep-ipam-config
windows: do not forgot IPAM configuration when re-creating networks
2025-08-07 12:41:50 +01:00
Olli Janatuinen
dcaf8893a0 windows: do not forgot IPAM configuration when re-creating networks
Signed-off-by: Olli Janatuinen <olli.janatuinen@gmail.com>
2025-08-06 16:49:20 +00:00
Sebastiaan van Stijn
28df781514 Merge pull request #50648 from thaJeztah/add_replace
add back replace and vendor, tidy
2025-08-06 18:02:15 +02:00
Sebastiaan van Stijn
0b2644b61f Merge pull request #50644 from thaJeztah/bump_runc
Dockerfile: update runc binary to v1.3.0
2025-08-06 17:52:32 +02:00
Sebastiaan van Stijn
0ad765c67d add back replace and vendor, tidy
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-06 16:30:57 +02:00
Sebastiaan van Stijn
3a4851d1f2 Merge pull request #50643 from thaJeztah/api_docs_sync
api/docs: sync v1.52 swagger with current version
2025-08-06 16:21:35 +02:00
Sebastiaan van Stijn
f5f984eec6 Dockerfile: update runc binary to v1.3.0
- release notes: https://github.com/opencontainers/runc/releases/tag/v1.3.0
- full diff: https://github.com/opencontainers/runc/compare/v1.2.6..v1.3.0

-----

This is the first release of the 1.3.z release branch of runc. It
contains a few minor fixes for issues found in 1.3.0-rc.2.

This is the first release of runc that will follow our new release and
support policy (see RELEASES.md for more details). This means that, as
of this release:

* As of this release, the runc 1.2.z release branch will now only
  receive security and "significant" bugfixes.
* Users are encouraged to plan migrating to runc 1.3.0 as soon as
  possible.
* Due to its particular situation, runc 1.1.z is officially no longer
  supported and will no longer receive any updates (not even for
  critical security issues). Users are urged (in the strongest possible
  terms) to upgrade to a supported version of runc.
* Barring any future changes to our release policy, users should expect
  a runc 1.4.0 release in late October 2025.

Fixed

* Removed pre-emptive "full access to cgroups" warning when calling
  `runc pause` or `runc unpause` as an unprivileged user without
  `--systemd-cgroups`. Now the warning is only emitted if an actual permission
  error was encountered.
* Several fixes to our CI, mainly related to AlmaLinux and CRIU.

Changed

* In runc 1.2, we changed our mount behaviour to correctly handle clearing
  flags. However, the error messages we returned did not provide as much
  information to users about what clearing flags were conflicting with locked
  mount flags. We now provide more diagnostic information if there is an error
  when in the fallback path to handle locked mount flags.
* Upgrade our CI to use golangci-lint v2.0.
* `runc version` information is now filled in using `//go:embed` rather than
  being set through `Makefile`. This allows `go install` or other non-`make`
  builds to contain the correct version information. Note that
  `make EXTRA_VERSION=...` still works.
* Remove `exclude` directives from our `go.mod` for broken `cilium/ebpf`
  versions. `v0.17.3` resolved the issue we had, and `exclude` directives are
  incompatible with `go install`.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-06 13:51:00 +02:00
Sebastiaan van Stijn
fadceb9253 Merge pull request #50338 from jirimoravcik/docs/improve-build-outputs-description
docs: api: improve the docs of the `outputs` parameter
2025-08-06 13:12:23 +02:00
Sebastiaan van Stijn
18940b6c9b Merge pull request #50640 from thaJeztah/update_tests
update some fixtures in tests
2025-08-06 13:01:12 +02:00
Sebastiaan van Stijn
234349d173 api/docs: sync v1.52 swagger with current version
This includes the changes from c13266d2c0
in the versioned swagger, as those changes were made after the
v1.52 versioned document was created.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-06 12:22:57 +02:00
Jiří Moravčík
833dc69ad9 docs: improve the description of the outputs parameter for /build endpoint
Signed-off-by: Jiří Moravčík <jiri.moravcik@gmail.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-06 12:18:00 +02:00
Akihiro Suda
2c1d9046b2 Merge pull request #50639 from thaJeztah/update_godocs
update various "doc" links in code
2025-08-06 13:32:43 +09:00
Akihiro Suda
491fe1fbcf Merge pull request #50642 from thaJeztah/mod_tidy
go.mod: tidy
2025-08-06 12:58:43 +09: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
90c3d29bfb go.mod: tidy
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-05 20:51:28 +02:00
Sebastiaan van Stijn
78ccee32b3 update various "doc" links in code
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-05 20:49:57 +02:00
Austin Vazquez
2ab75a2461 Merge pull request #50641 from austinvazquez/prepare-moby-client-v0.1.0-alpha.0
Bump api version in client and main module to v1.52.0-alpha.1
2025-08-05 11:34:02 -07:00
Austin Vazquez
d82f50557e Bump api version in client and main module to v1.52.0-alpha.1
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-08-05 13:19:45 -05:00
Sebastiaan van Stijn
37d0204d7f Merge pull request #50594 from thaJeztah/cleanup_v1_handling
builder-next: puller.Snapshot: cleanup handling of v1 images
2025-08-05 19:51:24 +02:00
Paweł Gronowski
8bd1ad8665 Merge pull request #50636 from thaJeztah/update_golangci_config
update golangci-lint settings
2025-08-05 17:40:34 +00:00
Sebastiaan van Stijn
141a97bdf9 Merge pull request #50555 from chunzhennn/49231-fix-memcg-swap-config-check
contrib/check-config: fix MEMCG_SWAP checking
2025-08-05 19:36:26 +02:00
Sebastiaan van Stijn
e7feeb10b9 Merge pull request #50602 from thaJeztah/cleanup_enabledisableservice
daemon/libnetwork: Sandbox.EnableService/DisableService slight cleanup
2025-08-05 19:35:10 +02:00
Paweł Gronowski
b99405e47b Merge pull request #48114 from thaJeztah/api_types_move_plugin_types
api/types: move plugin types to api/types/plugin
2025-08-05 17:33:48 +00:00
Sebastiaan van Stijn
4ed5ca3202 Merge pull request #50637 from dmcgowan/prepare-client-0.1.0-alpha.0
Prepare release notes for `client/v0.1.0-alpha.0`
2025-08-05 19:33:12 +02:00
Derek McGowan
a0a7d9a3d7 Add release notes for client/v0.1.0-alpha.0
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-08-05 09:16:34 -07:00
Derek McGowan
32ec26be6c Update client and main module api version to latest alpha tag
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-08-05 09:16:13 -07:00
Sebastiaan van Stijn
e30b8e3393 update golangci-lint settings
The github.com/docker/docker/reference package was moved to
github.com/moby/moby/v2/daemon/internal/refstore, so this
check no longer did anything (and no aliasing needed).

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-05 17:32:31 +02:00
Austin Vazquez
44bca1adf3 Merge pull request #50625 from dmcgowan/prepare-api-v1.52.0
Prepare release notes for v1.52.0-alpha.0
2025-08-05 07:45:38 -07:00
Sebastiaan van Stijn
57256a9b62 fix error-capitalization
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-05 15:42:59 +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
926ff237a9 Merge pull request #50632 from thaJeztah/move_error_response
api/types: move ErrorResponse to common/ErrorResponse
2025-08-05 15:41:49 +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
c77b27f2fc Merge pull request #50630 from thaJeztah/client_stdlib_errs
client: use stdlib errors
2025-08-05 14:43:06 +02:00
Sebastiaan van Stijn
485b11a6f7 Merge pull request #50599 from thaJeztah/cleanup_registry
daemon/pkg/registry: some cleanups to start separating "search"
2025-08-05 13:51:17 +02:00
Sebastiaan van Stijn
7fa01a73cd Merge pull request #50601 from thaJeztah/cleanup_buildSandboxOptions
daemon: make buildSandboxOptions, buildSandboxPlatformOptions more atomic
2025-08-05 13:49:10 +02:00
Sebastiaan van Stijn
15f78b752c daemon: make buildSandboxOptions, buildSandboxPlatformOptions more atomic
The buildSandboxPlatformOptions function was given a pointer to the
sboxOptions and modified it in-place.

Similarly, a pointer to the container was passed and `container.HostsPath`
and `container.ResolvConfPath` mutated. In cases where either of those
failed, we would return an error, but the container (and sboxOptions)
would already be modified.

This patch;

- updates the signature of buildSandboxPlatformOptions to return a fresh
  slice of sandbox options, which can be appended to the sboxOptions by
  the caller.
- uses intermediate variables for `hostsPath` and `resolvConfPath`, and
  only mutates the container if both were obtained successfully.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-05 11:59:46 +02:00
Sebastiaan van Stijn
77c2e3279d daemon/libnetwork: Sandbox.EnableService/DisableService slight cleanup
- remove/rename named error-return
- remove redundant defer
- use "continue" to reduce nesting
- use structured logs

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-05 11:56:00 +02:00
Paweł Gronowski
c6ca504388 Merge pull request #50626 from thaJeztah/add_v1.52_docs
api/docs: add v1.52 swagger
2025-08-05 09:22:06 +00:00
Sebastiaan van Stijn
7b8f841d1c Merge pull request #50628 from thaJeztah/bump_deps
go.mod: update containerd/v2 v2.1.4, dario.cat/mergo v1.0.2, docker/go-events, fernet/fernet-go
2025-08-05 09:32:14 +02:00
Sebastiaan van Stijn
bfce6556c4 client: use stdlib errors
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-05 09:11:21 +02:00
Sebastiaan van Stijn
e06826601c Merge pull request #50629 from thaJeztah/client_tidy
client: tidy go.mod
2025-08-05 08:22:48 +02:00
Sebastiaan van Stijn
3fe93532e4 client: tidy go.mod
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-04 20:40:57 +02:00
Sebastiaan van Stijn
3b14c5488f go.mod: github.com/containerd/containerd/v2 v2.1.4
full diff: https://github.com/containerd/containerd/compare/v2.1.3...v2.1.4

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-04 20:20:44 +02:00
Sebastiaan van Stijn
259eb259bc go.mod: dario.cat/mergo v1.0.2
drops gopkg.in/yaml.v3 as dependency

full diff: https://github.com/darccio/mergo/compare/v1.0.1...v1.0.2

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-04 20:20:36 +02:00
Sebastiaan van Stijn
d8b622b315 go.mod: github.com/docker/go-events v0.0.0-20250114142523-c867878c5e32
full diff: e31b211e4f...c867878c5e

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-04 20:14:12 +02:00
Sebastiaan van Stijn
8e63b55146 go.mod: github.com/fernet/fernet-go v0.0.0-20240119011108-303da6aec611
Update to the latest version, which is now a module;
full diff: 9f70042a33...303da6aec6

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-04 20:14:09 +02:00
Sebastiaan van Stijn
6b45c76a23 Merge pull request #50624 from thaJeztah/tidy
go.mod: tidy and update github.com/docker/docker v28.3.3
2025-08-04 20:06:40 +02:00
Sebastiaan van Stijn
87033e1857 Merge pull request #50612 from thaJeztah/stdcopy_clean
apk/pkg/stdcopy: remove use of `iota`, improve docs, and add example
2025-08-04 19:44:22 +02:00
Akihiro Suda
27c9ab1222 Merge pull request #50622 from vvoland/hack-mobyv2
hack: Fix references to old `docker/docker` module
2025-08-05 02:21:57 +09:00
Rob Murray
b789a8ca96 Merge pull request #50600 from thaJeztah/DNSConfig_netip
daemon/config: make DNSConfig.DNS a netip.Addr
2025-08-04 18:20:59 +01:00
Sebastiaan van Stijn
b672a78ca8 Merge pull request #50597 from thaJeztah/inline_containerExec
integration/container: TestCheckpoint: inline containerExec util
2025-08-04 19:14:15 +02:00
Sebastiaan van Stijn
559c3c7c6a Merge pull request #50620 from akerouanton/fix-firewalld-reload-deadlock
libnet/d/bridge: handleFirewalldReloadNw: fix deadlock
2025-08-04 19:13:20 +02:00
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
Paweł Gronowski
dfac16c297 hack: Update cosmetic occurences of the old package name
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-08-04 17:36:45 +02:00
Sebastiaan van Stijn
83267a0fda go.mod: github.com/docker/docker v28.3.3
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-04 17:27:10 +02:00
Sebastiaan van Stijn
5b3e1a6425 go.mod: tidy
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-04 17:23:32 +02:00
Austin Vazquez
01f2815c67 Merge pull request #50621 from randomnoise/docs-fix-subheading
docs: fix URI fragment by changing it to the existing subheading
2025-08-04 08:16:31 -07:00
Sebastiaan van Stijn
4a50295283 Merge pull request #50604 from thaJeztah/fix_testing_links
TESTING.md fix links to gotest.tools, and some touch-ups
2025-08-04 16:44:33 +02:00
Paweł Gronowski
0ae3cb000e validate/pkgimports: Fix package name
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-08-04 16:35:53 +02:00
Paweł Gronowski
22bd59010e hack: Fix dockerversion not being set correctly
Replace old package name with moby/v2

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-08-04 16:35:48 +02:00
Paweł Gronowski
79148460b0 hack/make.ps1: Replace old package name with moby/v2
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-08-04 16:35:47 +02:00
Paweł Gronowski
2dcd8b8def golangci: Replace old package name with moby/v2
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-08-04 16:35:44 +02:00
Austin Vazquez
e2ead4526d Merge pull request #50605 from thaJeztah/rm_image_spec_stubs
daemon/internal/image: remove image-spec markdown
2025-08-04 06:33:27 -07:00
Austin Vazquez
4761d97684 Merge pull request #50606 from thaJeztah/rm_contrib_syntax
contrib: remove syntax (Dockerfile syntax) files
2025-08-04 06:32:15 -07:00
Serhan Tutar
cad3a5775b docs: fix URI fragment by changing it to the existing subheading
Markdown subheading name was changed in `CONTRIBUTING.md` in the past,
so this commit fixes the link by changing it from `docker` to `moby`.

Signed-off-by: Serhan Tutar <randomnoise@users.noreply.github.com>
2025-08-04 13:46:24 +03:00
Albin Kerouanton
778d8e3a26 libnet/d/bridge: handleFirewalldReloadNw: fix deadlock
handleFirewalldReloadNw locks `d.mu` and then `d.configNetworks`.
However, the rest of the driver locks `d.configNetworks` first and then
`d.mu`.

This could result in deadlocks if `handleFirewalldReloadNw` is called
while the bridge driver is already holding `d.configNetworks` lock.

Other code paths were checked to ensure that they all follow the same
locking order.

This bug was introduced by commit a527e5a.

Signed-off-by: Albin Kerouanton <albinker@gmail.com>
2025-08-04 12:04:47 +02:00
Albin Kerouanton
519adb26c3 libnet/d/bridge: driver: un-embed mutex
The bridge driver was embedding `sync.Mutex` which is unconventional and
makes it harder to analyze locks ordering.

Signed-off-by: Albin Kerouanton <albinker@gmail.com>
2025-08-04 11:32:34 +02:00
Paweł Gronowski
71bd98436b Merge pull request #50607 from thaJeztah/contrib_rm_mac_install
contrib: remove `mac-install-bundle.sh` and `editorconfig`
2025-08-04 09:08:03 +00:00
Albin Kerouanton
81273c461d Merge pull request #50603 from thaJeztah/stricter_types
libnetwork/types: use stricter types for enums
2025-08-04 10:58:48 +02:00
Paweł Gronowski
bda0bab54f Merge pull request #50585 from robmry/nftables_check_config
check_config: add nftables modules to optional features
2025-08-04 08:29:46 +00:00
Akihiro Suda
7f45f08b48 Merge pull request #50598 from thaJeztah/detach_fetchManifest
router/distribution: fetchManifest; detach from distributionRouter
2025-08-04 15:13:30 +09:00
Akihiro Suda
fe2dbb36e6 Merge pull request #50610 from thaJeztah/dockerfile_swagger_version
Dockerfile: add GO_SWAGGER_VERSION build-arg
2025-08-04 15:12:14 +09: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
Akihiro Suda
d183ece79e Merge pull request #50609 from thaJeztah/api_any
api: update "interface{}" to "any"
2025-08-04 13:37:37 +09:00
Akihiro Suda
4946ec6fce Merge pull request #50611 from thaJeztah/client_update_godoc
client: touch-up godoc
2025-08-04 13:37:07 +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
195a6bbb1e client: touch-up godoc
Not perfect yet, but addressing some godoc "doc" links that needed
to be updated, and touching up some references.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-02 17:12:05 +02:00
Sebastiaan van Stijn
e7c784c270 Dockerfile: add GO_SWAGGER_VERSION build-arg
Allow overriding the go-swagger version to install.

With this patch:

    docker build -q --call=outline --target=swagger .

    TARGET: swagger

    BUILD ARG            VALUE                    DESCRIPTION
    GO_VERSION           1.24.5
    BASE_DEBIAN_DISTRO   bookworm
    GOLANG_IMAGE         golang:1.24.5-bookworm
    XX_VERSION           1.6.1
    GO_SWAGGER_VERSION   v0.32.3                  specifies the version of the go-swagger binary to install.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-02 01:40:20 +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
Sebastiaan van Stijn
0f9c087c91 Merge pull request #50519 from corhere/plugin-interface-type-pkg
api/types: fix Plugin.Config.Interface.Types Swagger definition
2025-08-02 00:34:28 +02:00
Sebastiaan van Stijn
dab42db691 contrib: remove editorconfig
This file was added in 962f347923, at which
time there already were doubts about it being useful. For Go, `gofmt`
already dictates formatting (and proper editors would integrat with
that). For other languages, most editors would already have a config,
and our CI validates formatting for various files.

Give that the file was never updated since it was added, it's fair
to say that it's unmaintained. Let's remove.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-02 00:01:43 +02:00
Sebastiaan van Stijn
5fbbf040aa contrib: remove mac-install-bundle.sh
This script was added in 6860c101ad
to allow testing a custom daemon in Docker Desktop, but has not
been maintained since, and likely no longer functional, so let's
remove.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-01 23:55:39 +02:00
Sebastiaan van Stijn
5a40d4ed9f contrib: remove syntax (Dockerfile syntax) files
The Dockerfile syntax is now maintained as part of BuildKit in the
https://github.com/moby/buildkit repository, but our contrib still
had syntax highlighting files for various editors;

- The TextMate (`.tmbundle`) syntax was last update 9 months ago
  in c2029cb257, but this was a stale
  pull request from 2018, so at least 7 Years behind on updates to
  the syntax.
- The vim syntax is now integrated in upstream, and our copy was
  remove 6 Years ago in 5511f45767.
- The Nano syntax was added 10 Years ago in 76bc44fb91,
  and received an update 9 Years ago in 4cb71f8082,
  and received no contributions since.
- The kate syntax was already unmaintained, and removed 9 Years ago
  in a2f695d7fa.

I think it's fair to state that these are unmaintained and severely outdated.
I _do_ think it would be good to have maintained versions of such files,
as it can improve the experience for users. However, this would be more
suitable for the BuildKit project, and I'm not sure if the current copies
of these files are a good starting point (if needed, they can still be
obtained from git history).

This patch removes the files.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-01 23:46:04 +02:00
Sebastiaan van Stijn
62545ddf90 daemon/internal/image: remove image-spec markdown
The image spec was moved to the github.com/moby/docker-image-spec repository,
and 03a17a2887 removed the files from the
moby repository, but left markdown files in place to point people to
the new location.

As these files were now moved internally, they no longer serve that purpose,
so we can remove them.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-01 23:19:28 +02:00
Sebastiaan van Stijn
4cfc260a5f TESTING.md fix links to gotest.tools, and some touch-ups
- Update links to use the correct (v3) version.
- Slightly touch-up examples.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-01 22:44:04 +02:00
Sebastiaan van Stijn
1205a15db1 libnetwork/types: define RouteType type
Define a `RouteType` type, type the related consts, and update the
`JoinInfo.AddStaticRoute` signature in the interface.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-01 22:33:10 +02:00
Sebastiaan van Stijn
6aab881534 libnetwork/types: make Protocol consts strong-typed
These use the Linux-specific values as convention, so unfortunately,
the syscall package doesn't define consts for these on Windows, so
keeping our own definition (values are not really relevant here).

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-01 22:33:08 +02:00
Sebastiaan van Stijn
ec5dbaf233 libnetwork/types: define IPFamily options using syscall.AF_XXX consts
Use the consts defined in syscall that basically match our intent here.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-01 22:33:03 +02:00
Sebastiaan van Stijn
95eeb0b3b0 libnetwork/types: define IPFamily type for IP-family consts
Define a type to help discovery, and update the signatures of
`ResolveName`, `Network.ResolveName`, and `Sandbox.ResolveName`
accordingly.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-01 22:32:57 +02:00
Sebastiaan van Stijn
311b2c87e1 Merge pull request #50384 from thaJeztah/daemon_inspect_unify
daemon: consolidate platform-specific inspectExecProcessConfig
2025-08-01 20:25:02 +02:00
Sebastiaan van Stijn
c55d02be07 Merge pull request #50507 from carsontham/migrate-test-container-api-rename
integration-cli: migrated test TestContainerAPIRename to docker/cli
2025-08-01 19:57:17 +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
5365f08ae2 daemon/config: make DNSConfig.DNS a netip.Addr
Modernize the field and allow using it as-is in some places, or
convert it to a string (which won't produce an error down the line).

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-01 18:48:10 +02:00
Sebastiaan van Stijn
a43198845b daemon/pkg/registry: un-export ResolveAuthConfig
It's now only used to back the `Service.ResolveAuthConfig` method, and
not used outside of the package currently.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-01 16:47:47 +02:00
Sebastiaan van Stijn
5fbf680f5d daemon/pkg/registry: move newIndexInfo to search
It's the only user of it.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-01 16:42:31 +02:00
Sebastiaan van Stijn
6a7f0008a3 daemon/pkg/registry: move searchRepositories to where it's used
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-01 16:42:31 +02:00
Sebastiaan van Stijn
17d0ac56f3 daemon/pkg/registry: remove session; make searchRepositories a func
The `session` struct was just bundling a http.Client with a v1Endpoint.
It was never a long-lived service; every use initialized the session,
only to call the `searchRepositories` method on it.

Dismantle it, and make it a regular function that gets a http.Client and
a v1Endpoint passed as argument.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-01 16:42:31 +02:00
Sebastiaan van Stijn
0c73c459b4 daemon/pkg/registry: un-export GetAuthConfigKey
We want to get rid of the use of using "registry.IndexInfo". Make the
function un-exported to discourage additional use.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-01 16:42:31 +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
aac2623115 integration/container: TestCheckpoint: inline containerExec util
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-01 16:36:43 +02:00
Sebastiaan van Stijn
5f121ce463 Merge pull request #50593 from thaJeztah/rm_unused_resolvconf
daemon/libnetwork/resolvconf: remove unused code
2025-08-01 16:35:05 +02:00
Sebastiaan van Stijn
03991f4846 builder-next: puller.Snapshot: cleanup handling of v1 images
- Remove redundant if/else
- Move vars closer to where used now that we don't have the if/else.
- Touch-up error-message to remove engine version and update doc link to DeprecatedSchema1ImageError.
- Touch-up TODOs and add reference to help trace back what's meant.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-01 14:50:26 +02:00
Sebastiaan van Stijn
0156a42200 daemon/libnetwork/resolvconf: remove unused code
This package is a wrapper for the libnetwork/internal/resolvconf package,
which is a modernized, more performant rewrite of the original parsing
code.

The libnetwork/resolvconf package was still maintained because it was
used by BuildKit, but since [moby/buildkit@3d43066], BuildKit maintains
its own copy of the internal package.

The only remaining uses of this package was as part of some tests (which
would also benefit of using the internal pacakge's implementation directly),
and a _single_ use of `resolvconf.Path` in the daemon, which cannot use
the internal package currently because it's internal to libnetwork.

This patch:

- Removes all functions that were not used.
- Rewrites some tests in libnetwork to use the internal/resolvconf package
  directly, instead of depending on the wrapper.
- Add TODOs to consider moving the "Path" function separate (which could
  be in daemon/config if we consider it to be the default for the daemon's
  resolvconf path configuration).

[moby/buildkit@3d43066]: 3d43066f2e

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-01 14:48:05 +02:00
Sebastiaan van Stijn
8c5c253b50 Merge pull request #50590 from thaJeztah/update_github_links
update github and pkg.go.dev links
2025-08-01 10:17:29 +02:00
carsontham
bbec7a5150 migrated test container API rename to docker/cli
Signed-off-by: carsontham <carsontham@outlook.com>
2025-08-01 13:27:07 +08:00
Sebastiaan van Stijn
3f54a4e539 Merge pull request #50589 from thaJeztah/remove_go_build
remove obsolete //go:build tags
2025-08-01 02:44:31 +02:00
Sebastiaan van Stijn
6d35ec7b42 Merge pull request #50588 from thaJeztah/cleanup_integration
integration: remove stray "distribution" directory
2025-08-01 02:15:08 +02:00
Sebastiaan van Stijn
1e499bae79 daemon: consolidate platform-specific inspectExecProcessConfig
This function was introduced in 1af76ef597
and based on the previous code in the daemon, which had platform-specific
handling for exec inspect in [setPlatformSpecificExecProcessConfig], which
was added in 5fa2e4d4f2 to account for
Windows not having "Privileged" and not setting the "User".

Given that "User" would be empty and "Privileged" not set, we may as well
combine both platforms, and just return the info we have.

[setPlatformSpecificExecProcessConfig]: 1af76ef597/daemon/exec_unix.go (L11-L21)

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-01 02:06:22 +02: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
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
Sebastiaan van Stijn
02b3f1cd99 integration: remove stray "distribution" directory
Looks like I accidentally added these 5 Years ago in
9f0b3f5609, and never
noticed.

Let's clean this up.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-31 23:53:33 +02:00
Sebastiaan van Stijn
ff14d7edf0 Merge pull request #50512 from dmcgowan/make-moby-v2-module
Make `github.com/moby/moby/v2` module
2025-07-31 23:41:00 +02:00
Rob Murray
297ea75204 check_config: add nftables modules to optional features
Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-07-31 19:38:33 +01:00
Derek McGowan
83357620e2 Update unit test script for windows
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-07-31 10:49:03 -07:00
Derek McGowan
58c95cde9b Replace uses of code which requires 1.24+
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-07-31 10:49:03 -07:00
Derek McGowan
900a0516de Update hack/test/unit for go module
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-07-31 10:49:02 -07:00
Derek McGowan
1d571e619d Rename build package to moby v2 module
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-07-31 10:49:02 -07:00
Derek McGowan
65867642d3 Remove go module workarounds
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-07-31 10:49:02 -07: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
a954a0f4a2 Remove profiles
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-07-31 10:13:08 -07:00
Derek McGowan
53bd828853 Remove libnetwork
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-07-31 10:13:08 -07:00
Sebastiaan van Stijn
4faedf2bec Merge pull request #50583 from thaJeztah/fix_auth
Revert "api/types/registry: EncodeAuthConfig: use empty string for zero value"
2025-07-31 17:26:56 +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
Akihiro Suda
39030fdf94 Merge pull request #50580 from thaJeztah/no_nat_step2
replace direct uses of nat types for api/types/container aliases
2025-07-31 14:32:23 +09:00
Sebastiaan van Stijn
5bbf3af980 daemon: fix linting S1016 (staticcheck) false positive
Staticcheck is suggesting to cast the type or to directly copy, but
doesn't account for nat.SortPortMap mutating the second argument, so
mutating the HostConfig.PortBindings. From the code, it looks like the
intent here was to prevent that (creating a deep copy), so let's keep
that.

    daemon/container_operations.go:109:39: S1016: should convert bb (type github.com/docker/docker/vendor/github.com/docker/go-connections/nat.PortBinding) to github.com/docker/docker/vendor/github.com/moby/moby/api/types/container.PortBinding instead of using struct literal (staticcheck)
                    bindings[p] = append(bindings[p], containertypes.PortBinding{
                                                      ^
    daemon/network.go:952:39: S1016: should convert bb (type github.com/docker/docker/vendor/github.com/docker/go-connections/nat.PortBinding) to github.com/docker/docker/vendor/github.com/moby/moby/api/types/container.PortBinding instead of using struct literal (staticcheck)
                    bindings[p] = append(bindings[p], containertypes.PortBinding{
                                                      ^

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-31 02:57:39 +02: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
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
0564d7f084 Merge pull request #50573 from thaJeztah/no_nat
api/types/container: add aliases for go-connections/nat types
2025-07-31 02:18: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
f3ba0b2dc2 client/pkg/jsonmessage: remove Stream interface
It was an interface to match CLI-specific primitives and is no
longer used.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-30 23:22:12 +02:00
Sebastiaan van Stijn
19edf5c53c client/pkg/jsonmessage: remove DisplayJSONMessagesToStream
It was an adaptor around DisplayJSONMessagesStream for CLI-specific
primitives that was used in the CLI, but can be implemented by users
of this package.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-30 23:22:09 +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
263a21705b Merge pull request #50574 from thaJeztah/remove_NoBaseImageSpecifier
api: remove deprecated NoBaseImageSpecifier
2025-07-30 16:41:50 +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
0d8ca8eefe Move pkg/jsonmessage to client/pkg/jsonmessage
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
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
ebef4a44fd Split streamformatter from jsonmessage
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-07-30 14:22:30 +02:00
Sebastiaan van Stijn
5a144c40e2 pkg/streamformatter: reduce jsonmessage.JSONMessage dependency
This package depends on jsonformatter.JSONProgress and jsonmessage.JSONMessage,
and it looks like it requires some of those for their stringer interface.

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
6453f9d5f4 Merge pull request #50570 from thaJeztah/jsonmessage_less_deps
pkg/jsonmessage: remove github.com/morikuni/aec dependency
2025-07-30 14:21:32 +02:00
Sebastiaan van Stijn
bda72b5c57 Merge pull request #50571 from thaJeztah/daemon_no_jsonstream
Add separate const for daemon httputils to avoid jsonmessage import
2025-07-30 14:21:08 +02:00
Sebastiaan van Stijn
7c626bea7e Merge pull request #50569 from thaJeztah/tidy_vendor
tidy vendor.mod
2025-07-30 14:20:48 +02:00
Sebastiaan van Stijn
9a52e474a3 pkg/jsonmessage: suppress unhandled errors
Keep the linters happy.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-30 12:48:02 +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
e257027903 pkg/jsonmessage: remove github.com/morikuni/aec dependency
We can probably use [aec.EmptyBuilder] for managing the output, but
currently we're doing it all manually, so defining some consts for
the basics we use.

[aec.EmptyBuilder]: https://pkg.go.dev/github.com/morikuni/aec#EmptyBuilder

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-30 12:34:45 +02:00
Sebastiaan van Stijn
d7082848a6 tidy vendor.mod
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-30 12:17:56 +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
1be59a838d Merge pull request #50558 from thaJeztah/cleanup_fileutils
remove pkg/fileutils, and move its functionality where used
2025-07-29 13:49:52 +02:00
Sebastiaan van Stijn
7381c0da6e Merge pull request #50554 from dmcgowan/move-logdriver-interface
Move logdriver interface
2025-07-29 13:47:47 +02:00
Sebastiaan van Stijn
0e582c691e Merge pull request #50557 from thaJeztah/registry_deadcode
daemon/pkg/registry: remove unused code
2025-07-29 13:38:00 +02:00
Sebastiaan van Stijn
12b761321b Merge pull request #50559 from thaJeztah/pkg_system_clean
pkg/system: move to daemon/internal
2025-07-29 13:05:40 +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
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
d94171bfaa pkg/system: make XattrError linux-only
It's only produced in Linux code, so put it in a Linux-only file.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-29 11:36:23 +02:00
Sebastiaan van Stijn
aa9de914ca pkg/system: remove unused ErrNotSupportedPlatform
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-29 11:36:23 +02:00
Sebastiaan van Stijn
28b822d5b3 pkg/system: remove Lgetxattr, Lsetxattr stubs for non-Linux
It's only used in Linux code. Remove the stubs, which are not carried
forward into the module.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-29 11:36:23 +02:00
Sebastiaan van Stijn
450ac30e4a pkg/system: LUtimesNano: remove stub for non-Linux
It's not used, and is not carried in the new module.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-29 11:36:23 +02:00
Sebastiaan van Stijn
03f44e6d14 pkg/system: MkdirAllWithACL: remove stubs and unused os.FileMode arg
Remove the stub implementation for non-Windows platforms, and remove the
os.FileMode argument, which is ignored on Windows.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-29 11:36:23 +02:00
Sebastiaan van Stijn
6f9e099fd3 pkg/system: remove deprecated IsAbs
It was deprecated in f8a2550a22, but won't
be carried to the new modules.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-29 11:36:22 +02:00
Sebastiaan van Stijn
53a3085256 pkg/system: remove deprecated EscapeArgs
It was deprecated in 63bada41e5, but won't
be carried to the new modules.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-29 11:36:20 +02:00
Sebastiaan van Stijn
8c7365e1ff Merge pull request #50556 from thaJeztah/builder_rm_dead_code
daemon/builder/remotecontext: remove detection of system.XattrError
2025-07-29 11:35:52 +02:00
Sebastiaan van Stijn
1313b8caff pkg/fileutils: move ReadSymlinkedDirectory to daemon
It has no external consumers, is written with specific behavior, making
it not a good candidate to carry in the module.

This moves it to the daemon as a non-exported `resolveSymlinkedDirectory`
utility, so that it's only accessible where it's currently used.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-29 11:17:32 +02:00
Sebastiaan van Stijn
ae0a3d6918 pkg/fileutils: move ReadSymlinkedDirectory internal to daemon
It has no external consumers, is written with specific behavior (including
some potentially surprising behavior), making it not a good candidate to
carry in the module.

This moves it internal to the daemon as a non-exported utility, so that
it's only accessible where it's currently used.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-29 11:16:25 +02:00
Sebastiaan van Stijn
bae46854c5 pkg/fileutils: remove unused CopyFile utility
It's not used, and has no external consumers; we don't have to carry it
in the new module.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-29 10:47:35 +02:00
Sebastiaan van Stijn
46854ca5ab daemon/pkg/registry: remove copy of rootless.RunningWithRootlessKit
Now that it's part of the daemon, we can use the internal
package again to help discovery of rootless-specific codepaths

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-29 10:39:26 +02:00
Sebastiaan van Stijn
f1c65c1dd6 daemon/pkg/registry: Service.Auth: remove unused statusMessage return
It was only used by the CLI, which now has its own fork.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-29 10:26:12 +02:00
Sebastiaan van Stijn
f797ced96a daemon/pkg/registry: remove unused ParseRepositoryInfo, RepositoryInfo
It was only used by the CLI, which now has its own fork.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-29 10:22:09 +02:00
Sebastiaan van Stijn
e30d541da0 daemon/pkg/registry: remove unused ReadCertsDirectory
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-29 10:07:44 +02:00
Sebastiaan van Stijn
d80e16bb18 daemon/pkg/registry: remove unused ParseSearchIndexInfo
It was only used by the CLI, which now has its own fork.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-29 10:06:36 +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
Derek McGowan
1dc53e8ec7 Update client go.mod
Remove transitive gogo dependency

Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-07-28 23:05:19 -07: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
5bbb7182e7 Move logdriver to internal under daemon/logger
The logdriver package should be moved to another external repository for
building plugins. While transitioning, move to internal package using
the same structure.

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
纯真
f866621303 contrib/check-config: fix kernel version range check
Signed-off-by: 纯真 <38834411+chunzhennn@users.noreply.github.com>
2025-07-29 10:45:18 +08:00
纯真
df8d45c7c9 contrib/check-config: fix MEMCG_SWAP
CONFIG_MEMCG_SWAP has been deprecated since kernel v5.8-rc1 (commit 2d1c498) and removed since kernel v6.1-rc1 (commit e55b9f9).

Since kernel v5.8-rc1, swap tracking has been an integral part of memory control. CONFIG_MEMCG_SWAP becomes invisible to user and simply means CONFIG_MEMCG && CONFIG_SWAP. 

Disable the check for kernel v5.8+.

Signed-off-by: 纯真 <38834411+chunzhennn@users.noreply.github.com>
2025-07-29 10:30:13 +08:00
Derek McGowan
ee24dcec3d Move swarm runtime plugin storage type to internal
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-07-28 18:18:39 -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
1e835a8cf5 Merge pull request #50550 from thaJeztah/rootless_internal
pkg/rootless: move to daemon/internal
2025-07-28 22:52:31 +02:00
Sebastiaan van Stijn
d761d9d358 pkg/rootless: move to daemon/internal
This package is used internally by the daemon, and was only used out
side of the daemon by pkg/plugins (for which we still need to look
where it should be kept).

Making it internal because it's trivial to implement if needed by
anyone. The only reason it's a package is to keep it central, and
to make it easier to discover where we have rootlesskit-specific
codepaths in our codebase.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-28 22:04:39 +02:00
Sebastiaan van Stijn
1e0531c8d5 Merge pull request #50533 from thaJeztah/internal_runconfig
runconfig: rewrite ContainerDecoder to DecodeCreateRequest
2025-07-28 21:29:08 +02:00
Sebastiaan van Stijn
0153bebebb Merge pull request #50547 from thaJeztah/internal_stack
pkg/stack: move to daemon/internal
2025-07-28 20:44:35 +02:00
Sebastiaan van Stijn
0075bafe0c Merge pull request #50548 from thaJeztah/rm_stringid_stdcopy
remove pkg/stringid, pkg/stdcopy as they moved to the client and api modules
2025-07-28 20:42:45 +02:00
Sebastiaan van Stijn
17959aff2c remove pkg/stdcopy as it has moved to the api module
pkg/stdcopy moved to github.com/moby/moby/api/stdcopy, and the 28.4
transitional releasee will provide an alias for those that use
github.com/docker/docker as dependency, so we can remove the alias
for the moby module.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-28 19:02:00 +02:00
Sebastiaan van Stijn
c055c3e098 remove pkg/stringid as it has moved to the client module
pkg/stringid moved to github.com/moby/moby/client/pkg/stringid, and
the 28.4 transitional releasee will provide an alias for those that
use github.com/docker/docker as dependency, so we can remove the
alias for the moby module.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-28 19:00:17 +02:00
Sebastiaan van Stijn
76e2ca1d41 pkg/stack: move to daemon/internal
This package is used by the daemon to produce a stack-dump, It has no
external consumers, so we can move it to daemon/internal.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-28 18:39:22 +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
1d6d8f390f Merge pull request #50495 from thaJeztah/move_back_StateStatus_take2
api/types/container: move StateStatus, NewStateStatus internal again
2025-07-28 17:30:48 +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
25e2b4d485 Merge pull request #50540 from thaJeztah/fix_vendor
fix vendor
2025-07-28 13:56:25 +02:00
Rob Murray
3555bb4193 Merge pull request #50539 from robmry/iptables_remove_unused_sctp_checksum
iptables: remove deprecated SCTP checksum rule
2025-07-28 12:19:28 +01:00
Sebastiaan van Stijn
a362ae937b Merge pull request #50532 from thaJeztah/runconfig_rm_errors
runconfig: remove exported errors
2025-07-28 12:46:28 +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
Sebastiaan van Stijn
dbfe7649e0 Merge pull request #50525 from thaJeztah/migrate_defaultshmsize_test
integration-cli: migrate TestPostContainersCreateShmSizeXXX to integration
2025-07-28 12:17:17 +02:00
Sebastiaan van Stijn
667cb4bec8 fix vendor
follow-up to e6298db297, which for some
reason didn't cause CI to fail.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-28 11:53:45 +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
Rob Murray
969b293778 iptables: remove SCTP checksum rule
Since 28.0.0, an iptables rule related to SCTP has only been
included if escape hatch variable DOCKER_IPTABLES_SCTP_CHECKSUM=1

Nobody's reported that the escape hatch was needed, and the rule
it guards doesn't make sense. So, remove.

Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-07-28 10:26:01 +01:00
Sebastiaan van Stijn
a7d4b915c3 Merge pull request #50524 from thaJeztah/cleanup_testutils
integration, integration-cli: remove various deprecated test-utilities, and some minor (linting) fixes
2025-07-28 11:11:48 +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
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
Paweł Gronowski
72455d522e Merge pull request #50528 from thaJeztah/checkpoint_no_decoder
daemon/server/router/checkpoint: remove unused httputils.ContainerDecoder
2025-07-28 08:10:57 +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
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
6b4dfb0135 integration-cli: migrate TestPostContainersCreateShmSizeXXX to integration
Some of these tests were making assumptions about the daemon's internals
by using `config.DefaultShmSize` from the daemon config package.

Rewrite them to start a daemon with a custom default, and verify the
tests to use that default.

This migrates the following tests from integration-cli to integration;

- `DockerAPISuite.TestPostContainersCreateShmSizeNegative`
- `DockerAPISuite.TestPostContainersCreateShmSizeHostConfigOmitted`
- `DockerAPISuite.TestPostContainersCreateShmSizeOmitted`
- `DockerAPISuite.TestPostContainersCreateWithShmSize`

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-26 20:52:00 +02:00
Sebastiaan van Stijn
617326a40c testutil, integration-cli: fix minor linting issues
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-26 16:34:31 +02:00
Sebastiaan van Stijn
da92ea2837 integration-cli/daemon: rewrite CheckActiveContainerCount with client
Use the API-client instead of shelling out to the CLI.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-26 16:34:30 +02:00
Sebastiaan van Stijn
6adbeff449 integration-cli: remove parseEventTime utility
It was only used in a single test.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-26 16:34:30 +02:00
Sebastiaan van Stijn
281a3f6c41 integration-cli: remove deprecaed inspectMountSourceField
The replacement is also deprecated, but at least returns a strong type,
which may help transitioning to using an api-client for these, and
removing one abstraction at a time.

Also rewriting the TestContainerAPIDeleteRemoveVolume to use the API
client (as it's part of the API suite), and touched-up the
TestRunMountShmMqueueFromHost test a bit.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-26 16:34:24 +02:00
Sebastiaan van Stijn
6124c00827 integration-cli: buildImageSuccessfully: don't wrap buildImage
Both are deprecated, but removing one abstraction at a time.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-26 13:05:40 +02:00
Sebastiaan van Stijn
877529c62d integration-cli: remove deprecated inspectFieldWithError utility
The replacement is also deprecated, but removing one abstraction at a time

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-26 13:00:11 +02:00
Sebastiaan van Stijn
68480dc11d integration-cli: remove createTmpFile utility
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-26 12:48:59 +02:00
Sebastiaan van Stijn
29a7d4039e integration-cli: remove deprecated inspectFieldMap utility
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-26 12:32:30 +02:00
Sebastiaan van Stijn
d100fd6a77 integration/system: remove "hdr" utility
It was a very shallow wrapper around reading the response
headers, and querying those directly is more transparent.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-26 12:19:22 +02:00
Sebastiaan van Stijn
97827e1a58 integration-cli: TestContainerAPIGetExport: fix minor linting issues
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-26 11:22:42 +02:00
Sebastiaan van Stijn
f73aba83dc client: TestContainerStats: fix minor linting issues
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-26 11:22:42 +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
c4afa77157 Merge pull request #50518 from thaJeztah/fix_du_options
api: move "DiskUsage" related types to the right location
2025-07-26 02:02:15 +02:00
Sebastiaan van Stijn
4dda328af8 client: rename files for system-commands to their canonical name
It took me some time to find these commands because they were not named
after their canonical name, unlike (most) other commands.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-26 00:12: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
Sebastiaan van Stijn
436a546c30 Merge pull request #50510 from corhere/kill-api-types-client
api/types: move client.go contents into moby/moby/client
2025-07-26 00:05:18 +02:00
Sebastiaan van Stijn
58bd636c3d Merge pull request #50516 from thaJeztah/integration_cli_rm_requirements
integration-cli: remove "requirement" package
2025-07-25 21:09:26 +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
f491b70aa4 integration-cli: remove "requirement" package
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-25 17:49:30 +02:00
Sebastiaan van Stijn
7dc46c6e0c Merge pull request #50504 from thaJeztah/pkg_stringid
pkg/stringid: deprecate, move to daemon, and provide copy in client
2025-07-25 16:00:06 +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
Sebastiaan van Stijn
57e1cb2a28 Merge pull request #50446 from dmcgowan/move-image-daemon
Move remaining image packages to daemon
2025-07-25 13:03:40 +02:00
Derek McGowan
0abcdb7405 Update golangci for lazyregexp
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-07-24 12:21:11 -07:00
Derek McGowan
6514282136 Move internal/testutils/networking to integration/internal/testutils/networking
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-07-24 12:16:06 -07:00
Derek McGowan
14eb2770b9 Move internal/unshare to daemon/internal/unshare
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-07-24 12:15:50 -07: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
20cc1a6203 Move internal/rootless to daemon/internal/rootless
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-07-24 12:15:02 -07:00
Derek McGowan
8042010175 Move internal/platform to daemon/internal/platform
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-07-24 12:14:46 -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
b62b542c2e Move internal/opts to daemon/internal/opts
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-07-24 12:14:14 -07:00
Derek McGowan
713d7f5ed1 Move internal/nlwrap to daemon/libnetwork/nlwrap
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-07-24 12:13:58 -07:00
Derek McGowan
fd21e3b935 Move internal/multierror to daemon/internal/multierror
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-07-24 12:13:42 -07:00
Derek McGowan
baea1c5092 Move internal/ioutils to daemon/internal/ioutils
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-07-24 12:13:26 -07:00
Derek McGowan
50743e3f38 Move internal/containerfs to daemon/internal/containerfs
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-07-24 12:13:10 -07:00
Derek McGowan
ca9c4dffb7 Move internal/cleanups to daemon/internal/cleanups
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-07-24 12:12:54 -07: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
ca5d2348d0 Move pkg/idtools to daemon/internal/idtools
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-07-24 12:12:07 -07:00
Derek McGowan
7bfb804dbe Move registry to daemon/pkg/registry
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-07-24 12:11:51 -07:00
Derek McGowan
f1f83dae55 Move reference to daemon/internal/refstore
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-07-24 12:11:35 -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
1ff6011e04 Move distribution to daemon/internal/distribution
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-07-24 12:10:46 -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
Rob Murray
462567acd6 Merge pull request #50505 from robmry/remove_TestRunDNSOptionsBasedOnHostResolvConf
Delete TestRunDNSOptionsBasedOnHostResolvConf
2025-07-24 17:00:43 +01:00
Sebastiaan van Stijn
49306c607b Merge pull request #50500 from thaJeztah/registry_fix_linting
registry: fix assorted linting issues
2025-07-24 16:00:36 +02:00
Paweł Gronowski
6cea77117d Merge pull request #50443 from corhere/fix-firewalld-reload
libnetwork/d/{bridge,overlay}: fix firewalld reload handling
2025-07-24 15:58:09 +02:00
Paweł Gronowski
665eb3aa88 Merge pull request #50386 from crazy-max/build-device-entitlement
build: device entitlement support
2025-07-24 15:57:52 +02:00
Rob Murray
3003c56c57 Delete TestRunDNSOptionsBasedOnHostResolvConf
Because:
- it's the last thing outside 'daemon/' that uses libnetwork's
  resolvconf package
- there's better coverage of the host resolv.conf transformations
  in the resolvconf package's unit tests
- there are integration tests that don't modify the test host's
  resolv.conf file in 'integration/networking/resolvconf_test.go'

Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-07-24 14:51:22 +01:00
Sebastiaan van Stijn
1f88663afc Merge pull request #50503 from thaJeztah/pkg_stringid_docs
pkg/stringid: TruncateID: touch-up doc
2025-07-24 14:23:36 +02:00
Sebastiaan van Stijn
3205fcf6c7 pkg/stringid: TruncateID: touch-up doc
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-24 12:41:10 +02: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
4929f522b8 Merge pull request #50498 from thaJeztah/registry_rm_deprecated
registry: remove deprecated RepositoryInfo.Official, Class fields
2025-07-24 11:30:15 +02:00
Sebastiaan van Stijn
6ed00d5044 registry: ConvertToHostname: use strings.Cut
Also prevents linters from flagging the use of "http://".

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-24 11:07:31 +02:00
Sebastiaan van Stijn
547a2db21d registry: TestNewIndexInfo: inline testIndexInfo (thelper)
It's not really a helper, and it's trivial to inline it;

    registry/registry_test.go:366:19: test helper function should start from t.Helper() (thelper)
      testIndexInfo := func(t *testing.T, config *serviceConfig, expectedIndexInfos map[string]*registry.IndexInfo) {
                       ^

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-24 11:00:52 +02:00
Sebastiaan van Stijn
5ea78575e7 registry: fix assorted gocritic issues
registry/auth.go:43:31: import-shadowing: The name 'auth' shadows an import name (revive)
    func NewStaticCredentialStore(auth *registry.AuthConfig) auth.CredentialStore {
                                  ^
    registry/auth.go:63:7: unused-receiver: method receiver 'scs' is not referenced in method's body, consider removing or renaming it as _ (revive)
    func (scs staticCredentialStore) SetRefreshToken(*url.URL, string, string) {
          ^
    registry/auth.go:143:40: import-shadowing: The name 'transport' shadows an import name (revive)
    func PingV2Registry(endpoint *url.URL, transport http.RoundTripper) (challenge.Manager, error) {
                                           ^
    registry/registry_mock_test.go:85:22: response body must be closed (bodyclose)
        res, err := http.Get(makeURL("/v1/_ping"))
                            ^
    registry/search_session.go:222:96: integer-format: fmt.Sprintf can be replaced with faster strconv.Itoa (perfsprint)
      u := r.indexEndpoint.String() + "search?q=" + url.QueryEscape(term) + "&n=" + url.QueryEscape(fmt.Sprintf("%d", limit))
                                                                                                    ^
    registry/auth.go:134:24: import-shadowing: The name 'url' shadows an import name (revive)
    func ConvertToHostname(url string) string {
                           ^
    registry/search_endpoint_v1.go:61: line-length-limit: line is 437 characters, out of limit 200 (revive)
                      return nil, invalidParamf("invalid registry endpoint %s: %v. If this private registry supports only HTTP or HTTPS with an unknown CA certificate, please add `--insecure-registry %s` to the daemon's arguments. In the case of HTTPS, if you have access to the registry's CA certificate, no need for the flag; simply place the CA certificate at /etc/docker/certs.d/%s/ca.crt", endpoint, err, endpoint.URL.Host, endpoint.URL.Host)
    registry/search_endpoint_v1.go:166:17: import-shadowing: The name 'transport' shadows an import name (revive)
    func httpClient(transport http.RoundTripper) *http.Client {
                    ^
    registry/search_session.go:239:26: ST1005: error strings should not be capitalized (staticcheck)
              return nil, errUnknown{fmt.Errorf("Unexpected status code %d", res.StatusCode)}
                                     ^
    registry/search_test.go:18:6: test helper function should start from t.Helper() (thelper)
    func spawnTestRegistrySession(t *testing.T) *session {
         ^

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-24 10:57:18 +02:00
Sebastiaan van Stijn
406ee2feb5 registry: translateV2AuthError: fix singleCaseSwitch (gocritic)
registry/errors.go:11:2: singleCaseSwitch: should rewrite switch statement to if statement (gocritic)
        switch e := err.(type) {
        ^
     registry/errors.go:13:3: singleCaseSwitch: should rewrite switch statement to if statement (gocritic)
            switch e2 := e.Err.(type) {
            ^
     registry/errors.go:15:4: singleCaseSwitch: should rewrite switch statement to if statement (gocritic)
                switch e2.Code {
                ^

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-24 10:33:44 +02:00
Sebastiaan van Stijn
ecb0354da5 registry: isCIDRMatch: fix captLocal (gocritic)
registry/config.go:267:46: captLocal: `URLHost' should not be capitalized (gocritic)
        func isCIDRMatch(cidrs []*registry.NetIPNet, URLHost string) bool {

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-24 10:33:44 +02:00
Sebastiaan van Stijn
1ceda96864 registry: serviceConfig.loadInsecureRegistries: fix ifElseChain (gocritic)
registry/config.go:171:3: ifElseChain: rewrite if-else to switch statement (gocritic)
            if strings.HasPrefix(strings.ToLower(r), "http://") {
            ^

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-24 10:33:44 +02:00
Sebastiaan van Stijn
fcb916ad17 Merge pull request #50487 from thaJeztah/deprecate_strslice_step1
remove, update tests for deprecated API versions
2025-07-24 03:15:46 +02:00
Sebastiaan van Stijn
84083b0037 Merge pull request #50496 from thaJeztah/rm_old_doc
docs: remove old rootless placeholder
2025-07-24 03:15:00 +02:00
Sebastiaan van Stijn
d4e85443ff registry: remove deprecated RepositoryInfo.Class field
This was deprecated in 5f91c769f5, which
was part of the v28.x release, and is no longer used so we can remove.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-24 03:04:22 +02:00
Sebastiaan van Stijn
cc2d564a9e registry: remove deprecated RepositoryInfo.Official field
This was deprecated in 08654b0b30, which
was part of the v28.x release, and is no longer used so we can remove.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-24 03:04:16 +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
c76f014a14 Merge pull request #50497 from thaJeztah/rm_contrib_gdb
contrib: remove gitdm
2025-07-24 02:10:26 +02:00
Sebastiaan van Stijn
5850abd9c7 Merge pull request #50492 from thaJeztah/rm_container_stats
api/types/container: remove deprecated Stats type
2025-07-24 02:09:49 +02:00
Sebastiaan van Stijn
38453db513 contrib: remove gitdm
This was added in bf6d52bba1, but don't
think it was ever used; at least it's severely outdated, so let's
remove it.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-24 00:54:01 +02:00
Sebastiaan van Stijn
0d9304c9e1 docs: remove old rootless placeholder
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-24 00:50:34 +02:00
Andrey Epifanov
a1f68bf5a6 overlay: Reload Ingress iptables rules in swarm mode
- Implement firewalld reload handling for Ingress rules restoration
- Add TestRestoreIngressRulesOnFirewalldReload() integration test

Signed-off-by: Andrey Epifanov <aepifanov@mirantis.com>
2025-07-23 15:52:10 -04:00
Andrey Epifanov
8b208f1b95 libnetwork: split programIngress() and dependent functions on Add and Del functions
- refactor programIngressPorts to use Rule.Insert/Append/Delete for improved rule management
- split programIngress() and dependent functions on Add and Del functions

Signed-off-by: Andrey Epifanov <aepifanov@mirantis.com>
2025-07-23 14:06:47 -04:00
Andrey Epifanov
50e6f4c4cb libnetwork: refactor ingress chain management for improved rule handling and initialization
Signed-off-by: Andrey Epifanov <aepifanov@mirantis.com>
2025-07-23 14:06:47 -04:00
Andrey Epifanov
4f0485e45f libnetwork: add FlushChain methods for improved iptables management
Signed-off-by: Andrey Epifanov <aepifanov@mirantis.com>
2025-07-23 14:06:47 -04:00
Andrey Epifanov
262c32565b libnetwork: refactor rule management to use Ensure method for Append and Insert operations
Signed-off-by: Andrey Epifanov <aepifanov@mirantis.com>
2025-07-23 14:06:47 -04:00
Andrey Epifanov
19a8083866 libnetwork: refactor iptable functions to include table parameter for improved rule management
Signed-off-by: Andrey Epifanov <aepifanov@mirantis.com>
2025-07-23 14:06:47 -04:00
Andrey Epifanov
c2e2e7fe24 libnetwork: extract plumpIngressProxy steps in a separate function
- Extract plumpIngressProxy steps in a separate function
- Don't create a new listener if there's already one in ingressProxyTbl

Signed-off-by: Andrey Epifanov <aepifanov@mirantis.com>
2025-07-23 14:06:47 -04:00
Andrey Epifanov
51ed289b06 libnetwork: extract programIngressPorts steps in a separate functions
Signed-off-by: Andrey Epifanov <aepifanov@mirantis.com>
2025-07-23 14:06:47 -04:00
Andrey Epifanov
752758ae77 libnetwork: extract creation/initiation of INGRESS-DOCKER chains in separate function
Signed-off-by: Andrey Epifanov <aepifanov@mirantis.com>
2025-07-23 14:06:47 -04:00
Andrey Epifanov
07393071ad bridge: Reapply endpoint iptables rules on firewalld reload
Signed-off-by: Andrey Epifanov <aepifanov@mirantis.com>
2025-07-23 14:06:44 -04:00
Rob Murray
6d457d9695 bridge: Trigger firewalld reload during bridge integration tests
Make sure iptables rules are restored properly once firewalld
has deleted them.

Signed-off-by: Rob Murray <rob.murray@docker.com>
Signed-off-by: Andrey Epifanov <aepifanov@mirantis.com>
2025-07-23 14:01:29 -04:00
Cory Snider
3c8ba15294 Merge pull request #50393 from corhere/libn/handle-coalesced-updates
libnetwork, libn/d/overlay: handle coalesced updates from NetworkDB
2025-07-23 14:00:50 -04: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
496c555d75 Merge pull request #50489 from thaJeztah/50166_followup
adjust minimum API-version for multiple platforms on save/load
2025-07-23 17:10:40 +02:00
Austin Vazquez
addc37324a Merge pull request #50485 from thaJeztah/client_remove_deprecated
client: remove deprecated types and functions
2025-07-23 07:28:13 -07: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
Paweł Gronowski
e870545dd4 Merge pull request #50479 from mdaffad/50159-migrate-test-api-client-version-old-not-supported
integration-cli: migrate TestAPIClientVersionOldNotSupported to integration
2025-07-23 15:54:16 +02:00
Sebastiaan van Stijn
a401c0c046 runconfig: update fixtures for TestDecodeContainerConfig
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-23 15:34:46 +02:00
Sebastiaan van Stijn
1378604cc3 integration-cli: remove tests for pre-docker 1.7 clients
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 remove these tests that
validate the behavior as they're invalid API requests.

This;

- removes DockerAPISuite.TestPostContainerAPICreateWithStringOrSliceEntrypoint
- removes DockerAPISuite.TestPostContainersCreateWithStringOrSliceCmd
- removes DockerAPISuite.TestPostContainersCreateWithStringOrSliceCapAddDrop
- updates DockerAPISuite.TestContainerAPIPostCreateNull, which used an invalid example

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

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-23 14:48:21 +02:00
Sebastiaan van Stijn
8d8bbefb90 client: remove deprecated CommonAPIClient interface
This interface was marked deprecated in 2997c0ddc0.

Now that the client is in a new module, we can remove the old.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-23 13:56:35 +02:00
Sebastiaan van Stijn
728f0769e1 client: remove deprecated ImageInspectWithRaw
This function was deprecated in 639a1214fa.
Now that the client is in a new module, we can remove the old.

This;

- Removes the `Client.ImageInspectWithRaw` implementation.
- Removes `ImageAPIClient.ImageInspectWithRaw` from the `ImageAPIClient` interface.
- Removes `APIClient.ImageInspectWithRaw` from the `APIClient` interface.
- Removes `ImageAPIClientDeprecated.ImageInspectWithRaw` from the `ImageAPIClientDeprecated`.
- Removes the `ImageAPIClientDeprecated` interface.

Note that the `ImageAPIClientDeprecated` interface itself was not marked
as deprecated, but it has no known external users, and it has no remaining
definitions.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-23 13:56:35 +02:00
Sebastiaan van Stijn
2f200f9e05 client: remove deprecated IsErrNotFound helper
This function was marked deprecated in 7aa7369f1f,
and is no longer used.

Now that the client is in a new module, we can remove the old.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-23 13:56:35 +02:00
Sebastiaan van Stijn
5ed9891eed client: remove deprecated ErrorConnectionFailed helper
This function was only used internally, and marked deprecated in
846b2272e6.

Now that the client is in a new module, we can remove the old.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-23 13:56:34 +02:00
Sebastiaan van Stijn
a0fa5da2ab client: remove deprecated NewClient and NewEnvClient functions
The `NewClient` and `NewEnvClient` function were deprecated in 2018
through 772edd020c, with the deprecation
message updated in a68ae4a2d9 and
6b9968e8b1 to make sure it's properly
identified as deprecated.

Now that the client is in a new module, we can remove the old.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-23 13:56:31 +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
Paweł Gronowski
db33a92940 Merge pull request #50484 from thaJeztah/client_update_example
client: fix example, and update refs to old modules
2025-07-23 13:50:57 +02:00
Sebastiaan van Stijn
2e2a8a7a7b Merge pull request #50285 from thaJeztah/request_clean_errs
client: Client.doRequest: improve some connection errors
2025-07-23 13:48:40 +02:00
Sebastiaan van Stijn
db58fa5fdc Merge pull request #50483 from thaJeztah/remove_import_exception
hack/validate: remove obsolete exception, fix missing alias for stdcopy.Systemerr
2025-07-23 13:31:48 +02:00
Sebastiaan van Stijn
96cbee8c60 Merge pull request #50166 from ctalledo/fix-for-48759
Add support for multiple platforms in image export and load
2025-07-23 12:52:34 +02:00
Rob Murray
b0c22a931d Merge pull request #50476 from robmry/bridge-accept-fw-mark
Add option --bridge-accept-fwmark
2025-07-23 10:55:36 +01:00
Rob Murray
2dbde139ee Merge pull request #50140 from robmry/non-gateway_routed_access
Always allow access to published ports on addresses in gateway mode "routed" networks
2025-07-23 10:54:47 +01:00
Sebastiaan van Stijn
30322dd649 client: fix example, and update refs to old modules
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-23 10:57:06 +02:00
Sebastiaan van Stijn
4859497098 pkg/stdcopy: fix missing alias for stdcopy.Systemerr
This was missed in 20d594fb79

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-23 01:35:06 +02:00
Sebastiaan van Stijn
01c7b4233c hack/validate: remove obsolete exception
This was added in 20d594fb79, but was
written before the API module was added. Now that the API is a separate
module, the check will no longer flag packages importing the API.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-23 01:35:00 +02:00
Cesar Talledo
b91ebbde6d Refactor containerd platform matchers.
Merge the matchAllWithPreference matcher into the matchAnyWithPreference
matcher to reduce code duplication and simplify the code.

Signed-off-by: Cesar Talledo <cesar.talledo@docker.com>
2025-07-23 01:31:39 +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
2303e6bff6 client: Client.doRequest: add special handling for DNS resolution errors
Before this patch:

    DOCKER_HOST=tcp://example.invalid/docker docker version
    error during connect: Get "http://example.invalid:2375/docker/v1.51/version": dial tcp: lookup example.invalid: no such host

With this patch:

    DOCKER_HOST=tcp://example.invalid/docker docker version
    failed to connect to the docker API at tcp://example.invalid:2375/docker: lookup example.invalid: no such host

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-23 01:20:54 +02:00
Sebastiaan van Stijn
67596f01e2 client: Client.doRequest: add special handling for "not found" errors
Before this change, a generic "Cannot connect to the docker daemon" error
was produced which, while helpful, instructed the user to check if the daemon
was running, but didn't provide context on the reason we failed (i.e., the
socket was not found).

This patch adds a dedicated check for cases where the socket was not found,
and preserves the original error.

Before this patch:

    DOCKER_HOST=unix:///var/run/no.sock docker version
    Cannot connect to the Docker daemon at unix:///var/run/no.sock. Is the docker daemon running?

With this patch:

    DOCKER_HOST=unix:///var/run/no.sock docker version
    failed to connect to the docker API at unix:///var/run/no.sock; check if the path is correct and the daemon is running: dial unix /var/run/no.sock: connect: no such file or directory

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-23 01:20:30 +02:00
Sebastiaan van Stijn
462d0ff5aa client: Client.doRequest: simplify permission check and unwrap error
Previously, we were using os.IsPermission, which doesn't unwrap errors;
change to use `errors.Is` to detect permission errors, and unwrap the
error to remove information about the request, which is irrelevant if
we weren't able to connect in the first place.

Also tweak the error slightly to not assume "docker socket", instead
mentioning "docker API".

Before this;

    permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get "http://%2Fvar%2Frun%2Fdocker.sock/v1.51/version": dial unix /var/run/docker.sock: connect: permission denied

With this patch applied:

    permission denied while trying to connect to the docker API at unix:///var/run/docker.sock: dial unix /var/run/docker.sock: connect: permission denied

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-23 01:20:01 +02:00
Sebastiaan van Stijn
7072acac79 client: Client.doRequest: preserve wrapped error
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-23 01:19:35 +02:00
Sebastiaan van Stijn
3b4fbaacd7 client: Client.doRequest: use early return
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-23 01:19:11 +02:00
Sebastiaan van Stijn
c55a163523 Merge pull request #50474 from thaJeztah/rm_go_build
api: remove references to old module name
2025-07-22 22:59:35 +02:00
Austin Vazquez
38a612c2f0 Merge pull request #50481 from thaJeztah/migrate_profiles
profiles/apparmor, seccomp: migrate to separate module
2025-07-22 11:50:31 -07:00
Rob Murray
cf1695bef1 Add option --bridge-accept-fwmark
Packets with the given firewall mark are accepted by the bridge
driver's filter-FORWARD rules.

The value can either be an integer mark, or it can include a
mask in the format "<mark>/<mask>".

Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-07-22 19:15:02 +01: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
a600da91f4 profiles/apparmor, seccomp: migrate to separate module
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-22 18:48:39 +02:00
Rob Murray
0c60a0e482 Merge pull request #50467 from robmry/no_nftables_in_swarm
No nftables in swarm
2025-07-22 16:58:26 +01:00
Rob Murray
30752f0780 Always allow access to routed endpoints
When an endpoint in a gateway mode "nat" network is selected
as a container's default gateway, the bridge driver sets up
bindings between host and container ports (NAT, userland proxy
etc).

When gateway mode "routed" was added as an alternative to
the default "nat" mode - port bindings followed the same rules.

But, unlike "nat" mode, there's no host port binding to set
up - there's routing between remote client and the container,
so it doesn't matter what the default gateway is.

So, in "routed" mode, set up the rules to make a container's
published ports accessible when the endpoint is added, and
remove those rules when the endpoint is removed (when the
container is disconnected from the endpoint's network).

Port mappings are only provided by ProgramExternalConnectivity,
they can't be set up during the Join. So, include routed
bindings in the port bindings mode that's stored as part of
endpoint state - and use that to work out whether to add or
remove bindings.

Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-07-22 16:51:59 +01:00
Cory Snider
4538a1de0a libnetwork: handle coalesced endpoint events
The eventually-consistent nature of NetworkDB means we cannot depend on
events being received in the same order that they were sent. Nor can we
depend on receiving events for all intermediate states. It is possible
for a series of entry UPDATEs, or a DELETE followed by a CREATE with the
same key, to get coalesced into a single UPDATE event on the receiving
node. Watchers of NetworkDB tables therefore need to be prepared to
gracefully handle arbitrary UPDATEs of a key, including those where the
new value may have nothing in common with the previous value.

The libnetwork controller naively handled events for endpoint_table
assuming that an endpoint leave followed by a rejoin of the same
endpoint would always be expressed as a DELETE event followed by a
CREATE. It would handle a coalesced UPDATE as a CREATE, adding a new
service binding without removing the old one. This would
have various side effects, such as having the "transient state" of
having multiple conflicting service bindings where more than one
endpoint is assigned an IP address never settling.

Modify the libnetwork controller to handle an UPDATE by removing the
previous service binding then adding the new one.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2025-07-22 11:51:18 -04:00
Cory Snider
e1a586a9a7 libnetwork/d/overlay: handle coalesced peer updates
The eventually-consistent nature of NetworkDB means we cannot depend on
events being received in the same order that they were sent. Nor can we
depend on receiving events for all intermediate states. It is possible
for a series of entry UPDATEs, or a DELETE followed by a CREATE with the
same key, to get coalesced into a single UPDATE event on the receiving
node. Watchers of NetworkDB tables therefore need to be prepared to
gracefully handle arbitrary UPDATEs of a key, including those where the
new value may have nothing in common with the previous value.

The overlay driver naively handled events for overlay_peer_table
assuming that an endpoint leave followed by a rejoin of the same
endpoint would always be expressed as a DELETE event followed by a
CREATE. It would handle a coalesced UPDATE as a CREATE, inserting a new
entry into peerDB without removing the old one. This would
have various side effects, such as having the "transient state" of
multiple entries in peerDB with the same peer IP never settle.

Update driverapi to pass both the previous and new value of a table
entry into the driver. Modify the overlay driver to handle an UPDATE by
removing the previous peer entry from peerDB then adding the new one.
Modify the Windows overlay driver to match.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2025-07-22 11:51:18 -04:00
Cory Snider
8340e109de libn/d/win/overlay: dedupe NetworkDB definitions
Windows and Linux overlay driver instances are interoperable, working
from the same NetworkDB table for peer discovery. As both drivers
produce and consume serialized data through the table, they both need to
have a shared understanding of the shape and semantics of that data.
The Windows overlay driver contains a duplicate copy of the protobuf
definitions used for marshaling and unmarshaling the NetworkDB peer
entries for dubious reasons. It gives us the flexibility to have the
definitions diverge, which is only really useful for shooting ourselves
in the foot.

Make daemon/libnetwork/drivers/overlay the source of truth for the peer
record definitions and the name of the NetworkDB table for distributing
peer records.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2025-07-22 11:51:18 -04:00
Cory Snider
c7b93702b9 libn/d/overlay: extract hashable address types
The macAddr and ipmac types are generally useful within libnetwork. Move
them to a dedicated package and overhaul the API to be more like that of
the net/netip package.

Update the overlay driver to utilize these types, adapting to the new
API.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2025-07-22 11:51:18 -04:00
Cory Snider
844023f794 libnetwork/driverapi: make EventNotify optional
Overlay is the only driver which makes use of the EventNotify facility,
yet all other driver implementations are forced to provide a stub
implementation. Move the EventNotify and DecodeTableEntry methods into a
new optional TableWatcher interface and remove the stubs from all the
other drivers.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2025-07-22 11:51:14 -04:00
Cory Snider
69c3c56eba libn/networkdb: report prev value in update events
When handling updates to existing entries, it is often necessary to know
what the previous value was. NetworkDB knows the previous and new values
when it broadcasts an update event for an entry. Include both values in
the update event so the watchers do not have to do their own parallel
bookkeeping.

Unify the event types under WatchEvent as representing the operation kind
in the type system has been inconvenient, not useful. The operation is
now implied by the nilness of the Value and Prev event fields.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2025-07-22 11:49:00 -04:00
Muhammad Daffa Dinaya
34fb2486ef test: migrate test api client version old not supported
Signed-off-by: Muhammad Daffa Dinaya <muhammaddaffadinaya@gmail.com>
2025-07-22 14:49:43 +00: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
Sebastiaan van Stijn
5b8ef1aff2 api: remove redundant //go:build lines
These are no longer neeeded now that it's a go module.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-22 15:49:55 +02:00
Sebastiaan van Stijn
e1281f09fc Merge pull request #50477 from thaJeztah/fix_vendor
fix vendor
2025-07-22 15:49:30 +02:00
Albin Kerouanton
f996384932 Merge pull request #50382 from akerouanton/split-nat-routed-portmappers
libnet/d/bridge: mv portmapper to libnet/pms/{nat,routed}
2025-07-22 15:45:52 +02:00
Sebastiaan van Stijn
260cc008f4 fix vendor
Commit a88e13f4f9 updated client code,
but did not re-vendor.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-22 15:27:20 +02:00
Albin Kerouanton
4e246efcd1 libnet/d/bridge: mv portmapper to libnet/pms/{nat,routed}
Signed-off-by: Albin Kerouanton <albinker@gmail.com>
2025-07-22 12:37:01 +02:00
Albin Kerouanton
289ef96d8b libnet/d/bridge/i/rlkclient: move to libnet/i/rlkclient
Signed-off-by: Albin Kerouanton <albinker@gmail.com>
2025-07-22 12:37:01 +02:00
Albin Kerouanton
41cd92f6c0 libnet/portmapperapi: add PortMapper interface, registry
Signed-off-by: Albin Kerouanton <albinker@gmail.com>
2025-07-22 12:37:01 +02:00
Albin Kerouanton
afb231d027 libnet/d/bridge: add a new Hairpin config flag
The bridge driver currently determines if hairpin mode is enabled by
checking whether the userland proxy is enabled, and if the binary path
is set to a non-empty string. It's used (amongst other things) by the
driver to decide whether 6-to-4 portmappings are supported, while it
normalizes port bindings.

As the userland proxy is going to be handled by the nat portmapper,
proxy-related params will be removed from the bridge driver, but the
port binding normalization will stay in the bridge driver.

So, introduce a new Hairpin config flag, and reimplement the original
logic in the daemon, when creating the bridge config.

Signed-off-by: Albin Kerouanton <albinker@gmail.com>
2025-07-22 12:37:01 +02:00
Albin Kerouanton
6f59a8e665 libnet/d/bridge: call setChildHostIP while binding
Signed-off-by: Albin Kerouanton <albinker@gmail.com>
2025-07-22 12:37:01 +02:00
Albin Kerouanton
43f384c452 libnet/d/bridge: connectivityConfiguration: use PortBindingReq type
Signed-off-by: Albin Kerouanton <albinker@gmail.com>
2025-07-22 12:37:01 +02:00
Albin Kerouanton
aa36cc5d25 libnet/d/bridge: move portBinding to portmapperapi
All unexported fields in portBinding are now exported.

Signed-off-by: Albin Kerouanton <albinker@gmail.com>
2025-07-22 12:37:01 +02:00
Albin Kerouanton
429818f969 libnet/d/bridge: move portBindingReq to portmapperapi
The two unexported fields of portBindingReq (ChildHostIP and DisableNAT)
are temporarily exported. DisableNAT will be replaced in a future commit
by a 'Mapper' field indicating which portmapper should be used (e.g.
'nat' or 'routed').

Signed-off-by: Albin Kerouanton <albinker@gmail.com>
2025-07-22 12:03:33 +02:00
Paweł Gronowski
c9a83e3161 Merge pull request #50448 from alessio-perugini/fix-data-race-on-list
client: fix datarace when accessing cli.Version field
2025-07-22 10:55:33 +02:00
Rob Murray
090c319f2e Don't allow the daemon to start with nftables and Swarm enabled
Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-07-22 09:13:45 +01:00
Rob Murray
26e487db78 testutil: Fix sense of hasFwBackendArg check
Introduced by commit 39ab393 ("Add daemon option --firewall-backend").

Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-07-22 09:13:11 +01:00
Sebastiaan van Stijn
596e088bd0 Merge pull request #50432 from thaJeztah/cleanup_request
client: cleanup encoding body and add test-coverage
2025-07-22 01:41:13 +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
29ab09d5d1 Merge pull request #50469 from thaJeztah/integration_noshadow
integration: rename vars that shadowed import
2025-07-21 15:05:45 -07: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
Sebastiaan van Stijn
9bed95200e Merge pull request #50468 from austinvazquez/add-awslog-driver-log-option-to-validate-list
fix: add create log stream awslog driver log option to validate list
2025-07-21 23:27:58 +02:00
Sebastiaan van Stijn
36d43f1432 Merge pull request #50454 from thaJeztah/pkg_process_split
pkg/process: separate exported funcs from implementation, and fix build-tag for implementation
2025-07-21 23:25:05 +02: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
c4f9616c4a client: cleanup encoding body and add test-coverage
This code has various other issue, for which TODOs were added; this
commit only does some initial cleaning up, and improves docs and
test-coverage.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-21 22:51:18 +02:00
Sebastiaan van Stijn
81caabae43 Merge pull request #50462 from thaJeztah/move_stdcopy
deprecate pkg/stdcopy, move to api/stdcopy
2025-07-21 22:50:05 +02:00
Sebastiaan van Stijn
b5d7d6c1e7 Merge pull request #50465 from thaJeztah/less_lazyregexp
remove uses of lazyregexp in tests, test-utilities and packages used externally
2025-07-21 22:49:30 +02:00
Sebastiaan van Stijn
024414b47e integration: rename vars that shadowed import
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-21 22:23:58 +02:00
Sebastiaan van Stijn
b0dbf751e1 Merge pull request #50460 from thaJeztah/tailfile_noshadow
pkg/tailfile: rename vars that shadowed type
2025-07-21 22:13:02 +02:00
Sebastiaan van Stijn
94866b10f9 Merge pull request #50461 from thaJeztah/oci_containerd
oci: deprecate SetCapabilities, and some minor cleanups/fixes
2025-07-21 22:08:00 +02:00
Sebastiaan van Stijn
b486373105 Merge pull request #50459 from thaJeztah/runconfig_touchup_godoc
runconfig: decodeContainerConfig: fix godoc referencing wrong type
2025-07-21 22:07:31 +02:00
Sebastiaan van Stijn
4f309de5c3 Merge pull request #50456 from thaJeztah/idtools_rm_deprecated
pkg/idtools: remove deprecated functions and types
2025-07-21 22:07:01 +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
Sebastiaan van Stijn
f651a5d5e9 registry: remove uses of lazyregexp
This package is imported by the CLI; implement a more basic approach.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-21 21:24:46 +02:00
Sebastiaan van Stijn
b33b4bd290 internal/testutils/networking: rm uses of lazyregexp
It's not needed for test-utilities.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-21 21:24:13 +02:00
Sebastiaan van Stijn
daa991c3d8 testutil/environment: don't use regex for string-matching error
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-21 21:24:11 +02:00
Sebastiaan van Stijn
0dc3193b2b integration-cli: remove uses of lazyregexp
Not needed for test-files.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-21 21:23:35 +02:00
Sebastiaan van Stijn
354efb065b Merge pull request #50280 from dmcgowan/api-go-mod
Create github.com/moby/moby/api and github.com/moby/moby/client module
2025-07-21 21:21:34 +02:00
Sebastiaan van Stijn
22bb28c98a Merge pull request #50447 from olljanat/win-keep-network-labels
windows: include labels when re-creating non-default nat networks
2025-07-21 19:56:58 +02:00
Austin Vazquez
6f9758047d fix: add create log stream awslog driver log option to validate list
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-07-21 10:16:53 -07:00
Derek McGowan
c47afd41c8 Create github.com/moby/moby/client module
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-07-21 09:30:26 -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
Derek McGowan
135cea2a10 Update test-unit for client module
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-07-21 09:29:26 -07:00
Derek McGowan
7e708a5416 Update unit tests for api module
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-07-21 09:29:26 -07:00
Derek McGowan
0971099c5f Add options to vendor to add and remove replace
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-07-21 09:29:25 -07:00
Derek McGowan
eab076f217 Gocompat tests no longer needed with go modules
These tests don't account well for submodules and are not needed when
importers are using go modules. The tests are still relevant in the 28
branch which does not use go modules.

Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-07-21 09:29:18 -07:00
Austin Vazquez
fb99e3375d Merge pull request #50464 from thaJeztah/rm_pkg_platform_leftovers
internal/platform: remove NumProcs() stub for Linux
2025-07-21 08:18:33 -07:00
Sebastiaan van Stijn
2b05296ee4 Merge pull request #50433 from thaJeztah/client_separate_version
client: define default (and maximum) API version
2025-07-21 17:08:20 +02: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
3c418749ad Merge pull request #50453 from thaJeztah/daemon_withfields
daemon: killProcessDirectly: use "WithFields" for logging
2025-07-21 17:05:56 +02:00
Paweł Gronowski
6462c01438 Merge pull request #50457 from thaJeztah/integration_cli_norunconfig
integration-cli: remove uses of "runconfig"
2025-07-21 15:42:36 +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
Sebastiaan van Stijn
61b19a494a oci: deprecate SetCapabilities
rewrite daemon.WithCapabilities using c8d's oci.WithCapabilities.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-21 15:29:43 +02:00
Sebastiaan van Stijn
b9196ed703 oci: fix godoc for SetCapabilities, TweakCapabilities
TweakCapabilities takes privileged into account, but SetCapabilities
does not, so fix the GoDoc.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-21 15:29:43 +02:00
Sebastiaan van Stijn
5c683e8603 oci: sort defaultLinuxMaskedPaths
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-21 15:29:42 +02:00
Rob Murray
3385489aef Merge pull request #50360 from robmry/nftables_with_firewalld
Nftables with firewalld
2025-07-21 14:25:25 +01:00
Sebastiaan van Stijn
0433def57d internal/platform: remove NumProcs() stub for Linux
Follow-up to 04618dfc0b, which removed
the pkg/platform package, but forgot to remove the stub.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-21 13:07:14 +02:00
Akihiro Suda
a1ee5668e8 Merge pull request #50452 from thaJeztah/api_remove_deprecated_aliases
api/types: remove deprecated aliases
2025-07-21 19:58:13 +09:00
Rob Murray
1a504f68fd Add nftables+firewalld tests to CI
Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-07-21 11:36:32 +01:00
Rob Murray
02d7a3026a Support nftables+firewalld
Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-07-21 11:36:32 +01:00
CrazyMax
d95dceb3b1 build: device entitlement support
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
2025-07-21 10:26:14 +02:00
Sebastiaan van Stijn
655dbe69d0 pkg/tailfile: rename vars that shadowed type
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-20 23:10:17 +02:00
Sebastiaan van Stijn
a089c51160 pkg/idtools: remove deprecated functions and types
Remove;

- `MkdirAllAndChown`
- `MkdirAndChown`
- `MkdirAllAndChownNew`
- `GetRootUIDGID`
- `FromUserIdentityMapping`
- `ToUserIdentityMapping`
- `CurrentIdentity`
- `IdentityMapping`
- `Identity.Chown`
- `IDMap`

Also remove the temporary consts that were previously in use by BuildKit;

- `SeTakeOwnershipPrivilege`
- `ContainerAdministratorSidString`
- `ContainerUserSidString`

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-20 23:06:16 +02:00
Sebastiaan van Stijn
3bc64b312e runconfig: decodeContainerConfig: fix godoc referencing wrong type
The ContainerConfigWrapper type was deprecated and removed; refer
to the correct type (container.CreateCreateRequest).

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-20 22:16:00 +02:00
Sebastiaan van Stijn
b10cbd9313 Merge pull request #50451 from thaJeztah/gha_bump_bk
hack/buildkit-ref: temporarily bump BuildKit to head of v0.23 branch
2025-07-20 22:15:49 +02:00
Sebastiaan van Stijn
ab5d348b77 integration-cli: remove uses of "runconfig"
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-20 21:04:49 +02:00
Sebastiaan van Stijn
0c3185a835 daemon: killProcessDirectly: use "WithFields" for logging
Don't chain "WithError" and "WithFields"

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-20 15:09:07 +02:00
Sebastiaan van Stijn
1cc42643ae hack/buildkit-ref: temporarily bump BuildKit to head of v0.23 branch
To skip some flaky tests on Windows

diff: https://github.com/moby/buildkit/compare/v0.23.2...dd2b4e18663c58ac3762d7b60b2c3301f71d5fa9

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-20 15:06:15 +02:00
Sebastiaan van Stijn
18e463a082 api/types: remove deprecated RequestPrivilegeFunc type
This was added in bb899c654a,
which shipped in the latest v28.x releases, so we can remove these.

This removes the `RequestPrivilegeFunc` type.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-20 14:56:56 +02:00
Sebastiaan van Stijn
a3920ae6a0 api/types: remove deprecated IDResponse type
This was added in b99b5422b0,
which shipped in the latest v28.x releases, so we can remove these.

This removes the `IDResponse` type.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-20 14:55:38 +02:00
Sebastiaan van Stijn
3e5a06179e api/types: remove deprecated container-inspect types
This was added in 1abc8f6158,
which shipped in the latest v28.x releases, so we can remove these.

This removes the `ContainerJSONBase`, `ContainerJSON` types.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-20 14:53:25 +02:00
Sebastiaan van Stijn
8347b05435 api/types: remove deprecated Container type
This was added in 05b0e653dd,
which shipped in the latest v28.x releases, so we can remove these.

This removes the Container type.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-20 14:50:56 +02:00
Sebastiaan van Stijn
f050df0329 api/types: remove deprecated ContainerState type
This was added in 84ffc644ef,
which shipped in the latest v28.x releases, so we can remove these.

This removes the ContainerState type.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-20 14:50:06 +02:00
Sebastiaan van Stijn
7abeb4d5a4 api/types: remove deprecated container-networksettings types
This was added in df22a511cb,
which shipped in the latest v28.x releases, so we can remove these.

This removes the NetworkSettings, NetworkSettingsBase, DefaultNetworkSettings,
and SummaryNetworkSettings types.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-20 14:49:03 +02:00
Sebastiaan van Stijn
c5a2194b5d api/types: remove deprecated container Health types
This was added in c130ce1f5d,
which shipped in the latest v28.x releases, so we can remove these.

This removes the `Health` and `HealthcheckResult` types to the container package,
as well as the related `NoHealthcheck`, `Starting`, `Healthy`, and `Unhealthy`
consts.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-20 14:46:37 +02:00
Sebastiaan van Stijn
76bf0e2929 api/types: remove deprecated MountPoint
These was added in 5517322cf9,
which shipped in the latest v28.x releases, so we can remove these.

This removes the deprecated `api/types.MountPoint`.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-20 14:44:12 +02:00
Sebastiaan van Stijn
207db8792e api/types: remove deprecated Port
These was added in e12b7493b9,
which shipped in the latest v28.x releases, so we can remove these.

This removes the deprecated `api/types.Port`.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-20 14:43:11 +02:00
Sebastiaan van Stijn
fa8177ba7a api/types: remove deprecated GraphDriverData
These was added in da039ca918,
which shipped in the latest v28.x releases, so we can remove these.

This removes the deprecated `api/types.GraphDriverData`.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-20 14:41:42 +02:00
Sebastiaan van Stijn
836ec65d5f api/types: remove deprecated ImageInspect, RootFS
These was added in 7053007f71,
which shipped in the latest v28.x releases, so we can remove these.

This removes the deprecated `api/types.ImageInspect` and
`RootFS`.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-20 14:39:58 +02:00
Sebastiaan van Stijn
7d3459e7fb api/types: remove deprecated SecretCreateResponse, SecretListOptions
These was added in 23117afca8,
which shipped in the latest v28.x releases, so we can remove these.

This removes the deprecated `api/types.SecretCreateResponse` and
`SecretListOptions`.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-20 14:38:02 +02:00
Sebastiaan van Stijn
68744c8b05 api/types: remove deprecated ConfigCreateResponse, ConfigListOptions
These was added in a411a39be0,
which shipped in the latest v28.x releases, so we can remove these.

This removes the deprecated `api/types.ConfigCreateResponse` and
`ConfigListOptions`.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-20 14:36:58 +02:00
Sebastiaan van Stijn
33f07ff3f4 api/types: remove deprecated NodeListOptions, NodeRemoveOptions
These was added in f008d85edc,
which shipped in the latest v28.x releases, so we can remove these.

This removes the deprecated `api/types.NodeListOptions` and
`NodeRemoveOptions`.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-20 14:35:06 +02:00
Sebastiaan van Stijn
f13796d2af api/types: remove deprecated TaskListOptions
These was added in 5ad0867236,
which shipped in the latest v28.x releases, so we can remove these.

This removes the deprecated `api/types.TaskListOptions`

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-20 14:33:43 +02:00
Sebastiaan van Stijn
72b1e11264 api/types: remove deprecated ServiceCreateOptions
These aliases were added in 31d62930f7,
which shipped in the latest v28.x releases, so we can remove these.

This removes the deprecated `api/types.ServiceCreateOptions`

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-20 14:32:13 +02:00
Sebastiaan van Stijn
3faead6fc1 api/types: remove deprecated ServiceUpdateOptions
These aliases were added in 0b1c7a8306,
which shipped in the latest v28.x releases, so we can remove these.

This removes the deprecated `api/types`;

- `ServiceUpdateOptions`
- `RegistryAuthFromSpec`
- `RegistryAuthFromPreviousSpec`

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-20 14:30:56 +02:00
Sebastiaan van Stijn
55ad118eaf api/types: remove deprecated ServiceListOptions, ServiceInspectOptions
These aliases were added in b13528522a,
which shipped in the latest v28.x releases, so we can remove this.

This removes the deprecated `api/types.ServiceListOptions` and
`api/types.ServiceInspectOptions` types.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-20 14:29:07 +02:00
Sebastiaan van Stijn
91558ae3f3 api/types: remove deprecated SwarmUnlockKeyResponse
This alias was added in 7e8f630bec,
which shipped in the latest v28.x releases, so we can remove this.

This removes the deprecated `api/types.SwarmUnlockKeyResponse` type.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-20 14:26:54 +02:00
Sebastiaan van Stijn
74fe646ac2 api/types: remove deprecated build-cache types
These aliases were added in eefe68a37c,
which shipped in the latest v28.x releases, so we can remove these.

This removes the deprecated `api/types`;

- `BuildCache`
- `BuildCachePruneOptions`
- `BuildCachePruneReport`

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-20 14:25:20 +02:00
Sebastiaan van Stijn
3eac6e7888 api/types: remove deprecated BuildResult
This alias was added in bb7dbaafcd,
which shipped in the latest v28.x releases, so we can remove this.

This removes the deprecated `api/types.BuildResult` type.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-20 14:03:59 +02:00
Sebastiaan van Stijn
088cb2ffa6 api/types: remove deprecated build-related types
These aliases were added in 3d1e4d9002,
which shipped in the latest v28.x releases, so we can remove these.

This removes the deprecated `api/types`;

- `ImageBuildOptions`
- `ImageBuildOutput`
- `ImageBuildResponse`
- `BuilderVersion`
- `BuilderV1`
- `BuilderBuildKit`

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-20 14:00:45 +02:00
Sebastiaan van Stijn
1359046a36 pkg/process: call out that "Zombie" is only supported on Linux
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-18 16:16:08 +02:00
Sebastiaan van Stijn
94618ac3ab pkg/process: separate exported funcs from implementation
This allows us to maintain GoDoc in a single place, and for
"Kill" and "Alive" to have consistent error-handling (Windows
does not support negative process-IDs).

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-18 16:16:05 +02:00
Alessio Perugini
a88e13f4f9 client: fix datarace when accessing cli.Version field
Originally I've found this datarace on a project I'm working at. I'm not
able to consistently reproduce this. But by looking at the codebase I
took a chance to fix other 2 possible function that might produce such
data race.

Original stack trace produced when running `go test -race` on GH CI:

```
WARNING: DATA RACE
Write at 0x00c0005dc688 by goroutine 43:
  github.com/docker/docker/client.(*Client).negotiateAPIVersionPing()
      /home/runner/go/pkg/mod/github.com/docker/docker@v28.2.2+incompatible/client/client.go:389 +0x12f
  github.com/docker/docker/client.(*Client).checkVersion()
      /home/runner/go/pkg/mod/github.com/docker/docker@v28.2.2+incompatible/client/client.go:298 +0x249
  github.com/docker/docker/client.(*Client).getAPIPath()
      /home/runner/go/pkg/mod/github.com/docker/docker@v28.2.2+incompatible/client/client.go:307 +0x76
  github.com/docker/docker/client.(*Client).sendRequest()
      /home/runner/go/pkg/mod/github.com/docker/docker@v28.2.2+incompatible/client/request.go:111 +0x9b
  github.com/docker/docker/client.(*Client).get()
      /home/runner/go/pkg/mod/github.com/docker/docker@v28.2.2+incompatible/client/request.go:28 +0x736
  github.com/docker/docker/client.(*Client).ContainerList()
      /home/runner/go/pkg/mod/github.com/docker/docker@v28.2.2+incompatible/client/container_list.go:47 +0x6f0

Previous read at 0x00c0005dc688 by goroutine 42:
  github.com/docker/docker/client.(*Client).ContainerList()
      /home/runner/go/pkg/mod/github.com/docker/docker@v28.2.2+incompatible/client/container_list.go:39 +0x5ef
```

Co-authored-by: Luca Rinaldi <lucarin@protonmail.com>
Signed-off-by: Alessio Perugini <alessio@perugini.xyz>
2025-07-18 11:07:44 +02:00
Olli Janatuinen
e6cdf24bcd windows: include labels when re-creating non-default nat networks
Signed-off-by: Olli Janatuinen <olli.janatuinen@gmail.com>
2025-07-18 00:24:59 -07: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
Rob Murray
2f4f78bd3c Merge pull request #50327 from Adrien-Atmosphere/50326-wait-for-dependent-containers
Wait for container dependencies upon daemon start up
2025-07-17 20:24:34 +01:00
Rob Murray
87fdd1bfca Merge pull request #50437 from thaJeztah/no_scratch
api: deprecate NoBaseImageSpecifier
2025-07-17 19:39:56 +01:00
Rob Murray
8c79486dab Merge pull request #50357 from robmry/firewall_backend_option
Add daemon option --firewall-backend
2025-07-17 19:21:12 +01:00
Adrien Pompée
d4e026fe20 Wait for container dependencies upon daemon start up
- Get dependent containers before starting containers
- Dependent containers can be either from legacy link or container network
- Wait on a best effort basis for the dependent containers

Fixes: #50326

Signed-off-by: Adrien Pompée <adrien.pompee@atmosphere.aero>
2025-07-17 19:41:39 +02:00
Sebastiaan van Stijn
c616e7690f Merge pull request #50421 from vvoland/ci-c8d-windows
ci/windows: Always run tests with c8d
2025-07-17 16:18:13 +02:00
Rob Murray
39ab393274 Add daemon option --firewall-backend
Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-07-17 15:12:01 +01: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
Rob Murray
254f64ded6 Merge pull request #50434 from thaJeztah/resolvconf_no_write
libnet/internal/resolvconf: don't use rc.WriteFile in tests
2025-07-17 13:35:42 +01: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
Sebastiaan van Stijn
2b17ab0ec6 libnet/internal/resolvconf: fix naming of error (errname)
#27 94.97 executor/oci/internal/resolvconf/resolvconf.go:461:6: the error type name `systemErr` should conform to the `xxxError` format (errname)
    #27 94.97 type systemErr struct{ error }
    #27 94.97      ^

Also fix an unhandled error; we don't need a defer() for that one

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-17 13:58:31 +02:00
Sebastiaan van Stijn
aa757e591d libnet/internal/resolvconf: don't use rc.WriteFile in tests
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-17 13:57:38 +02:00
Sebastiaan van Stijn
9af9d2742c Merge pull request #50428 from thaJeztah/resolvconf_notemplate
libnet/internal/resolvconf: optimize Generate() without text/template
2025-07-17 12:01:18 +02:00
Sebastiaan van Stijn
8d54d36bce libnet/internal/resolvconf: fix naming of error
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-17 11:43:33 +02:00
Sebastiaan van Stijn
60a3a28a04 libnet/internal/resolvconf: minor optimizations
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-17 11:40:17 +02:00
Sebastiaan van Stijn
f22a3dfdb7 libnet/internal/resolvconf: optimize Generate() without text/template
Rewrite this function to not use text/template, which is ~74× faster,
~25× less memory, and ~56× fewer allocations.

Before/After:

    BenchmarkGenerate-10       42550     27439 ns/op    18083 B/op    394 allocs/op
    BenchmarkGenerate-10     3148328       373 ns/op      712 B/op      7 allocs/op

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-17 11:40:11 +02:00
Sebastiaan van Stijn
0775ab6661 libnet/internal/resolvconf: add benchmark for Generate()
goos: darwin
    goarch: arm64
    pkg: github.com/docker/docker/daemon/libnetwork/internal/resolvconf
    cpu: Apple M1 Pro
    BenchmarkGenerate
    BenchmarkGenerate-10    	   42550	     27439 ns/op	   18083 B/op	     394 allocs/op
    PASS

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-17 11:37:28 +02:00
Sebastiaan van Stijn
41da5700a4 client: define default (and maximum) API version
With the client and API migrating to separate modules, users of the Client
module may upgrade the API module to higher versions. Currently, the Client
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 Client
to support higher API versions than it was written for.

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

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-17 11:20:17 +02:00
Sebastiaan van Stijn
4c6f586740 Merge pull request #50426 from thaJeztah/no_empty_auth
api/types/registry: EncodeAuthConfig: use empty string for zero value
2025-07-17 08:33:54 +02:00
Sebastiaan van Stijn
098ff1aed1 Merge pull request #50405 from thaJeztah/bump_dev_tools
Dockerfile: update CLI to v28.3.2, Buildx v0.25.0, compose v2.38.2
2025-07-17 06:58:13 +02:00
Sebastiaan van Stijn
9fb7c6a493 Merge pull request #50425 from thaJeztah/detect_empty_authconfig
api/types/registry: DecodeAuthConfig: add early returns and improve errors
2025-07-17 06:56:31 +02:00
Sebastiaan van Stijn
28adc4a395 Merge pull request #50408 from thaJeztah/docker_py_reformat
hack/make/test-docker-py: split test-exclusions to separate lines
2025-07-17 06:55:17 +02:00
Austin Vazquez
535c2bc6b7 Merge pull request #50429 from dmcgowan/detangle-testutil-imports
Move testutils image load to integration internal
2025-07-16 18:32:57 -07:00
Austin Vazquez
977dd1833b Merge pull request #50365 from dmcgowan/move-builder-daemon
Move builder under daemon
2025-07-16 16:29:00 -07:00
Derek McGowan
b54bde4376 Move testutils image load to integration internal
The image load is only used by integration tests but the specialimage
testutils package used by many different tests. The image load relies on
the client which creates a transitive client dependency from the daemon
packages.

Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-07-16 16:15:27 -07:00
Derek McGowan
b83f36877f Move internal/mod to daemon/internal/builder-next/worker/mod
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-07-16 15:06:31 -07: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
Derek McGowan
6ff9bea6a7 Move builder/builder-next to daemon/internal/builder-next
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-07-16 15:05:44 -07:00
Austin Vazquez
7766b8a763 Merge pull request #50423 from thaJeztah/fix_context_linting
builder/remotecontext/git: fix linting issues
2025-07-16 15:01:06 -07:00
Sebastiaan van Stijn
3a447bc079 api/types/registry: EncodeAuthConfig: use empty string for zero value
Currently, EncodeAuthConfig always returns a base64url-encoded JSON
doc, even if an empty auth-config passed. As a result, it's more
complicated to detect if authentication was present.

This patch changes the behavior to return an empty string for these
cases so that teh client can skip setting the `X-Registry-Auth` header,
and the daemon can detect whether authentication is sent or not.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-16 22:26:10 +02:00
Sebastiaan van Stijn
472e09ac47 api/types/registry: DecodeAuthConfig: add early returns and improve errors
Add an early return for empty JSON or malformed base64url values.

Before:

    go test -bench=DecodeAuthConfig -benchmem ./api/types/registry/
    goos: darwin
    goarch: arm64
    pkg: github.com/docker/docker/api/types/registry
    cpu: Apple M1 Pro
    BenchmarkDecodeAuthConfig/empty-10           47380755        25.44 ns/op      112 B/op          1 allocs/op
    BenchmarkDecodeAuthConfig/empty_JSON-10       2426870       491.70 ns/op     3056 B/op          8 allocs/op
    BenchmarkDecodeAuthConfig/valid-10             909601      1255.00 ns/op     3160 B/op         13 allocs/op
    BenchmarkDecodeAuthConfig/invalid_base64-10   1679551       703.40 ns/op     3410 B/op         15 allocs/op
    BenchmarkDecodeAuthConfig/malformed_JSON-10   1387849       817.10 ns/op     4795 B/op         12 allocs/op
    PASS

After:

    go test -bench=DecodeAuthConfig -benchmem ./api/types/registry/
    goos: darwin
    goarch: arm64
    pkg: github.com/docker/docker/api/types/registry
    cpu: Apple M1 Pro
    BenchmarkDecodeAuthConfig/empty-10           45892863        25.11 ns/op      112 B/op          1 allocs/op
    BenchmarkDecodeAuthConfig/empty_JSON-10      25347739        46.50 ns/op      115 B/op          2 allocs/op
    BenchmarkDecodeAuthConfig/valid-10            1292016       928.10 ns/op     1208 B/op         12 allocs/op
    BenchmarkDecodeAuthConfig/invalid_base64-10   5728990       208.50 ns/op      160 B/op          6 allocs/op
    BenchmarkDecodeAuthConfig/malformed_JSON-10   1821925       646.80 ns/op     2833 B/op         13 allocs/op
    PASS

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-16 22:25:43 +02:00
Sebastiaan van Stijn
6865032baa api/types/registry: add BenchmarkDecodeAuthConfig
Basic benchmark;

    go test -bench=DecodeAuthConfig -benchmem ./api/types/registry/
    goos: darwin
    goarch: arm64
    pkg: github.com/docker/docker/api/types/registry
    cpu: Apple M1 Pro
    BenchmarkDecodeAuthConfig/empty-10           47380755        25.44 ns/op      112 B/op          1 allocs/op
    BenchmarkDecodeAuthConfig/empty_JSON-10       2426870       491.70 ns/op     3056 B/op          8 allocs/op
    BenchmarkDecodeAuthConfig/valid-10             909601      1255.00 ns/op     3160 B/op         13 allocs/op
    BenchmarkDecodeAuthConfig/invalid_base64-10   1679551       703.40 ns/op     3410 B/op         15 allocs/op
    BenchmarkDecodeAuthConfig/malformed_JSON-10   1387849       817.10 ns/op     4795 B/op         12 allocs/op
    PASS

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-16 22:25:42 +02:00
Sebastiaan van Stijn
c1e5ab4e50 Merge pull request #50415 from thaJeztah/push_no_empty_body_step1
client: always send (empty) body on push
2025-07-16 19:45:17 +02:00
Rob Murray
55f0bd8ee9 Merge pull request #50345 from corhere/libn/networkdb-property-testing
libnetwork/networkdb: add property-based tests
2025-07-16 18:44:23 +01:00
Paweł Gronowski
c1b95c0ca2 ci/windows: Always run tests with c8d
Remove the special condition needed to run Windows integration tests
with the containerd integration enabled in addition to the graphdriver.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-07-16 18:04:31 +02:00
Paweł Gronowski
d716e4c46d Merge pull request #50424 from vvoland/fix-windows-ci-test
integration: Skip TestRunMountImageMultipleTimes on Windows
2025-07-16 18:03:52 +02:00
Sebastiaan van Stijn
121518bc78 Merge pull request #50416 from thaJeztah/resolvconf_modernize
libnet/internal/resolvconf: use slices.Clone
2025-07-16 17:26:07 +02:00
Paweł Gronowski
967daa627a integration: Skip TestRunMountImageMultipleTimes on Windows
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-07-16 17:25:37 +02:00
Sebastiaan van Stijn
a615ec798d builder/remotecontext/git: fix linting issues
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-16 16:27:48 +02:00
Paweł Gronowski
d33d46d016 Merge pull request #50418 from vvoland/api-bump
api: bump to 1.52
2025-07-16 14:07:40 +02:00
Paweł Gronowski
f88631b4b3 Merge pull request #50417 from dmcgowan/remove-unneeded-integraiton-test
Remove integration test using daemon internals
2025-07-16 11:55:54 +02:00
Paweł Gronowski
e32e1f6f04 Merge pull request #50268 from vvoland/image-mount-multiple
daemon: Fix mounting same image multiple times with different destinations
2025-07-16 11:21:47 +02:00
Paweł Gronowski
6a8654a808 api: bump to 1.52
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-07-16 11:10:32 +02:00
Akihiro Suda
543c4339a4 Merge pull request #50411 from thaJeztah/client_ContainerExecAttach_linkify
client: ContainerExecAttach: update GoDoc links
2025-07-16 11:07:21 +09:00
Akihiro Suda
33533378ae Merge pull request #50409 from thaJeztah/registry_nohomedir
registry: replace pkg/homedir.GetConfigHome for os.UserConfigDir
2025-07-16 11:06:43 +09:00
Cory Snider
ac5f464649 libnetwork/networkdb: improve quality of randomness
The property test for the mRandomNodes function revealed that it may
sometimes pick out a sample of fewer than m nodes even when the number
of nodes to pick from (excluding the local node) is >= m. Rewrite it
using a random shuffle or permutation so that it always picks a
uniformly-distributed sample of the requested size whenever the
population is large enough.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2025-07-15 18:07:59 -04:00
Cory Snider
5799deb853 libnetwork/networkdb: test quality of mRandomNodes
TestNetworkDBAlwaysConverges will occasionally find a failure where one
entry is missing on one node even after waiting a full five minutes. One
possible explanation is that the selection of nodes to gossip with is
biased in some way. Test that the mRandomNodes function picks a
uniformly distributed sample of node IDs of sufficient length.

The new test reveals that mRandomNodes may sometimes pick out a sample
of fewer than m nodes even when the number of nodes to pick from
(excluding the local node) is >= m. Put the test behind an xfail tag so
it is opt-in to run, without interfering with CI or bisecting.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2025-07-15 18:07:54 -04:00
Cory Snider
d8730dc1d3 libnetwork/networkdb: add convergence test
Add a property-based test which asserts that a cluster of NetworkDB
nodes always eventually converges to a consistent state. As this test
takes a long time to run it is build-tagged to be excluded from CI.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2025-07-15 18:07:09 -04:00
Derek McGowan
7771a38896 Remove integration test using daemon internals
Integration tests should not be using daemon internals. Since this is
testing against regression and the relevant code has a feature freeze on
it, this test can be removed. The test is not relevant with containerd,
which has more protection against these cases through gc.

Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-07-15 11:48:34 -07:00
Derek McGowan
17d5f731f1 Move internal/safepath to daemon/volume/safepath
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-07-15 10:45:47 -07:00
Derek McGowan
7edd7c68b1 Move internal/mounttree to daemon/internal/mounttree
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-07-15 10:45:31 -07:00
Derek McGowan
daeaac0d3c Move internal/directory to daemon/internal/directory
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-07-15 10:45:15 -07:00
Derek McGowan
33d824b838 Move quota to daemon/internal/quota
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-07-15 10:45: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
Rob Murray
d86a303086 Merge pull request #50397 from thaJeztah/testutil_denoise
minor cleanups and reduce logs in tests
2025-07-15 17:25:29 +01:00
Sebastiaan van Stijn
cf3a152c61 Merge pull request #50410 from thaJeztah/bump_cgroups
vendor: github.com/opencontainers/cgroups v0.0.4
2025-07-15 18:03:26 +02:00
Sebastiaan van Stijn
fdd9ae3465 libnet/internal/resolvconf: use slices.Clone
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-15 17:28:59 +02:00
Albin Kerouanton
d8089c82ed Merge pull request #50362 from akerouanton/linux-osallocator
libnet/portallocator: introduce OSAllocator
2025-07-15 13:56:16 +02:00
Sebastiaan van Stijn
b1ce0c89f0 client: always send (empty) body on push
Before ea29dffaa5, the image create endpoint
had a [fallback for very old client versions][1] that would send authentication
as body instead of through the `X-Registry-Auth` header.

However, the implementation of this fallback did not handle empty bodies,
resulting in an `io.EOF` error to be returned when trying to parse the
body as JSON.

In practice, this problem didn't happen when using the CLI, because even
if no authentication was present, `registry.EncodeAuthConfig()` (used by
the CLI to set the `X-Registry-Auth` header) would produce an empty JSON
document (`{}`), which would be encoded in base64 (`e30=`), so we would
never set an empty `X-Registry-Auth` (but other clients may have hit this
situation). That behavior was unexpected, because not all registries require
authentication, and omitting the `X-Registry-Auth` should be valid. We
also want to have more flexibility in authentication (and being able to
distinguish unauthenticated requests, so that we can fallback to
alternative paths).

Unfortunately, we can't change existing daemons, so must account for the
faulty fallback. Currently, omitting the `X-Registry-Auth` produces an
error, but we can avoid this by unconditionally sending a body, which
may be an empty JSON document (`{}`).

I explored possible options for this; we can either construct our own
empty JSON (`json.RawMessage("{}")`) to be explicit that we're sending
empty JSON, but [`encodeBody()`][2] is currently hard-coded to expect
JSON requests, and unconditionally calls [`encodeData`][3], which
encodes to JSON, so we may as well take advantage of `http.NoBody`,
which gets marshaled to an empty JSON document;
https://go.dev/play/p/QCw9dJ6LGQu

    package main

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

    func main() {
        body, _ := json.Marshal(http.NoBody)
        fmt.Println(string(body))
    }

Before this patch, a client omitting `X-Registry-Auth` (and no body)
would produce an error;

    docker pull -q busybox
    docker tag busybox 127.0.0.1:5001/myimage:latest

    docker run -d --name registry -p 127.0.0.1:5001:5000 registry:3
    docker push 127.0.0.1:5001/myimage:latest
    Error response from daemon: bad parameters and missing X-Registry-Auth: invalid X-Registry-Auth header: EOF

With this patch applied, no error is produced;

    docker pull -q busybox
    docker tag busybox 127.0.0.1:5001/myimage:latest

    docker run -d --name registry -p 127.0.0.1:5001:5000 registry:3
    docker push 127.0.0.1:5001/myimage:latest
    The push refers to repository [127.0.0.1:5001/myimage]
    189fdd150837: Pushed
    latest: digest: sha256:68a0d55a75c935e1101d16ded1c748babb7f96a9af43f7533ba83b87e2508b82 size: 610

[1]: 63fcf7d858/api/types/registry/authconfig_test.go (L109-L114)
[2]: 63fcf7d858/client/request.go (L67-L87)
[3]: 63fcf7d858/client/request.go (L296-L304)
[4]: ea29dffaa5

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-15 13:51:52 +02:00
Albin Kerouanton
50d2dafc7f libnet/portallocator: introduce OSAllocator
This new struct allocates ports from the operating system by creating
sockets and binding them. It's based on the existing bindTCPOrUDP and
bindSCTP functions previously defined in the bridge driver. It tries to
detect conflicts on best effort basis, and doesn't guarantee that the
ports it allocates are not in use by other processes.

Signed-off-by: Albin Kerouanton <albinker@gmail.com>
2025-07-15 12:16:01 +02:00
Sebastiaan van Stijn
14bd3451d8 client: ContainerExecAttach: update GoDoc links
- Use doc-links for references to other types.
- Fix reference to "types.HijackedConnection", which doesn't exist.
- Use a bullet-list for the different stream formats used.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-15 10:44:31 +02:00
Rob Murray
63fcf7d858 Merge pull request #50288 from dmcgowan/move-libnetwork-daemon
Move libnetwork under daemon
2025-07-15 08:19:30 +01:00
Sebastiaan van Stijn
830e0d79f5 vendor: github.com/opencontainers/cgroups v0.0.4
- fs2: Fix statHugeTlb error when rsvd usage is present
- fs2: ignore no device error when reading freezer state

No changes in vendored code

full diff: https://github.com/opencontainers/cgroups/compare/v0.0.3...v0.0.4

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-15 00:58:44 +02:00
Sebastiaan van Stijn
d66cf14a87 registry: replace pkg/homedir.GetConfigHome for os.UserConfigDir
The registry package is used in docker/cli, and currently depends on
pkg/homedir. This package was anly used when running with rootlesskit,
which only is supported on Linux; on other platforms, homedir.GetConfigHome
would return an error;
abba330bbf/pkg/homedir/homedir_others.go (L24-L27)

Replace homedir.GetConfigHome with os.UserConfigDir from stdlib, which
is similar, with exception of not falling back to `getent` for
resolving the user's homedir, which would be a corner-case.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-14 23:30:54 +02:00
Paweł Gronowski
14d9be4978 daemon: Fix mounting same image multiple times with different destinations
The previous implementation generated layer names based on container ID
and source image, which would cause conflicts when mounting the same
image to multiple destinations within a container.

This fixes the issue by changing the layer naming strategy to include
the destination path in the layer name, making it unique for each mount
point.

To avoid filesystem paths producing unexpected names, the combined
string is hex-encoded and used as a layer name.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-07-14 20:34:24 +02:00
Derek McGowan
a28f031298 Fix libnetwork proto generation
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-07-14 10:35:07 -07:00
Derek McGowan
b1884b6bba Restore libnetwork/resolvconf
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-07-14 10:35:06 -07:00
Derek McGowan
3b5f7c2a29 Move internal/modprobe to daemon/libnetwork/internal/modprobe
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-07-14 09:25:55 -07:00
Derek McGowan
7f4713a364 Move internal/maputil to daemon/libnetwork/internal/maputil
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-07-14 09:25:39 -07:00
Sebastiaan van Stijn
22ed8b1327 hack/make/test-docker-py: split test-exclusions to separate lines
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-14 18:25:30 +02: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
Derek McGowan
f05652867d Move opts to daemon/pkg/opts
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-07-14 09:25:05 -07:00
Sebastiaan van Stijn
abba330bbf Merge pull request #50208 from thaJeztah/rm_deprecated
pkg/* remove deprecated functions and packages
2025-07-14 16:18:20 +02:00
Paweł Gronowski
649256a269 Merge pull request #50387 from thaJeztah/flaky_TestRemoveContainerWithVolume
integration/container: fix flaky TestRemoveContainerWithVolume
2025-07-14 16:14:44 +02:00
Paweł Gronowski
33f1ac3c83 Merge pull request #50398 from thaJeztah/less_pkg_system
pkg/system: remove EnableContainerdRuntime, ContainerdRuntimeSupported
2025-07-14 13:24:21 +02:00
Akihiro Suda
407881d45a Merge pull request #50392 from thaJeztah/authcfg_coverage
api/types/registry: add some tests for encoding/decoding authconfig
2025-07-14 19:40:52 +09:00
Paweł Gronowski
a470ad7ffd Merge pull request #50390 from Abubacarr075/50159-migrate-api-images-history-cli-tests-to-integration
migrate test api images history integration cli test to integration test
2025-07-14 12:26:31 +02:00
Sebastiaan van Stijn
7fba6cb96c Merge pull request #50396 from thaJeztah/flaky_TestRestartStoppedContainer
integration-cli: fix flaky TestRestartStoppedContainer
2025-07-14 11:49:30 +02:00
Akihiro Suda
2dd6dcb75a Merge pull request #50400 from thaJeztah/api_deprecated_container_types
api/types/container: remove deprecated ContainerUpdateOKBody, ContainerTopOKBody
2025-07-14 17:40:50 +09:00
Akihiro Suda
e00c358b5f Merge pull request #50399 from thaJeztah/pkg_system_deprecate_escapeargs
pkg/system: deprecate EscapeArgs, IsAbs and move them internal
2025-07-14 17:40:27 +09:00
Paweł Gronowski
3ae462e370 Merge pull request #50403 from thaJeztah/xfail_TestExecResize
integration/container: XFAIL flaky TestExecResize on Windows
2025-07-14 09:17:21 +02:00
Sebastiaan van Stijn
e0292b6da6 Merge pull request #50406 from thaJeztah/bump_delve
Dockerfile: upgrade Delve to v1.25.0
2025-07-14 00:51:25 +02:00
Sebastiaan van Stijn
fb2117987d Dockerfile: upgrade Delve to v1.25.0
Update to the latest version:

- https://github.com/go-delve/delve/releases/tag/v1.25.0
- https://github.com/go-delve/delve/blob/v1.25.0/CHANGELOG.md#1250-2025-04-16

Also update links to supported platforms.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-13 17:33:31 +02:00
Sebastiaan van Stijn
18438f3c13 Dockerfile: update compose to v2.38.2
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-13 17:25:15 +02:00
Sebastiaan van Stijn
8c3e10a011 Dockerfile: update buildx to v0.25.0
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-13 17:24:22 +02:00
Sebastiaan van Stijn
4dee288b51 Dockerfile: update cli to v28.3.2
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-13 17:23:36 +02: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
fd8fec18cd integration/container: XFAIL flaky TestExecResize on Windows
This test is failing frequently (50%) on Windows;

    === FAIL: github.com/docker/docker/integration/container TestExecResize/success (0.01s)
        exec_test.go:144: assertion failed: error is not nil: Error response from daemon: NotFound: exec: '9c19c467436132df24d8b606b0c462b1110dacfbbd13b63e5b42579eda76d7fc' in task: '7d1f371218285a0c653ae77024a1ab3f5d61a5d097c651ddf7df97364fafb454' not found: not found

Let's keep the test, but log the failure and skip on Windows.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-13 15:13:16 +02:00
Sebastiaan van Stijn
4a8d77c958 api/types/container: remove deprecated ContainerTopOKBody alias
This was deprecated in be1ac5d8e5, which
was part of v28, so we can remove it for v29

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-12 20:40:03 +02:00
Sebastiaan van Stijn
3d8d9c2bb3 api/types/container: remove deprecated ContainerUpdateOKBody alias
This was deprecated in f4dc38cd36, which
was part of v28, so we can remove it for v29

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-12 20:38:50 +02:00
Sebastiaan van Stijn
f8a2550a22 pkg/system: deprecate IsAbs and move internal
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-12 19:51:34 +02:00
Sebastiaan van Stijn
63bada41e5 pkg/system: deprecate EscapeArgs and move internal
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-12 19:49:22 +02:00
Sebastiaan van Stijn
0fc1493654 pkg/system: remove EnableContainerdRuntime, ContainerdRuntimeSupported
These functions were used internally to keep track of whether containerd
was enabled as runtime on Windows; move it to libcontainerd.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-12 19:16:30 +02:00
Sebastiaan van Stijn
a327a9f341 integration-cli: fix flaky TestRestartStoppedContainer
This test was failing frequently on Windows, waiting for the state
of the container to be "running" after restarting, however, this
would race because the command of the container was very short-lived;

    === Failed
    === FAIL: github.com/docker/docker/integration-cli TestDockerCLIRestartSuite/TestRestartStoppedContainer (37.00s)
        docker_cli_restart_test.go:42: assertion failed: error is not nil: condition ""true" == "false"" not true in time (20s)

Ironically, that check was added in 48ccdd46ae
to make the test less flaky.

This patch takes the approach from TestRestartRunningContainer, which had
similar issues on Windows that were addressed in bae22d167c

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-12 17:45:27 +02:00
Sebastiaan van Stijn
59d5743a43 testutil/daemon: Daemon.Stop() don't log when already stopped
`Daemon.Stop()` is called in teardown of tests, resulting in a lot of noise;

    docker_cli_network_unix_test.go:52: [d124e10f67e01] daemon is not started
    docker_cli_network_unix_test.go:1143: [dadd2ae3b638b] daemon is not started
    docker_cli_external_volume_driver_test.go:59: [d50e371ba1d6f] daemon is not started

Let's ignore if the daemon is already stopped, as that's what we want to here.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-12 17:39:14 +02:00
Sebastiaan van Stijn
1c8b09ccf6 integration-cli: TestDockerNetworkHostModeUngracefulDaemonRestart start, not restart
This test was testing a non-gracceful kill od the daemon, after which it
started it again, however `d.Stop()` would log that the daemon wasn't running,
which is expected, so let's reduce noise;

    docker_cli_network_unix_test.go:1143: [dadd2ae3b638b] daemon is not started

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-12 17:35:51 +02:00
Sebastiaan van Stijn
9e69fc567e testutil/daemon: remove string-matching for error
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-12 17:31:20 +02:00
Sebastiaan van Stijn
cf41e9ac60 testutil/daemon: gofumpt
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-12 17:30:56 +02:00
Sebastiaan van Stijn
d6c90dcb87 integration/container: fix flaky TestRemoveContainerWithVolume
This test depended on the container to die after running the `true` command,
but this condition failed frequently on Windows 2025.

    === Failed
    === FAIL: github.com/docker/docker/integration/container TestRemoveContainerWithVolume (32.68s)
        remove_test.go:61: timeout hit after 10s: waiting for container State.Status to be 'exited', currently 'running'

While this may be revealing an actual issue (and we should have a test for
that), it's irrelevant for this test, which;

- creates and starts a container with an anonymous volume
- verifies the anonymous volume was created
- removes the container
- verifies the anonymous volume was removed

We can force-remove the container to kill, and removed it; we probably
could've sufficed with "container create" (without starting), but it's
good to add extra coverage, in case running the container impacts whether
we're able to remove the volume.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-12 15:58:27 +02:00
Sebastiaan van Stijn
d30e61bff4 api/types/registry: add some tests for encoding/decoding authconfig
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-12 15:52:50 +02:00
Sebastiaan van Stijn
1d272a430d Merge pull request #50373 from thaJeztah/registry_deprecated
registry: remove deprecated `HostCertsDir()` and `SetCertsDir()`
2025-07-11 23:32:19 +02:00
Sebastiaan van Stijn
a7488beadd Merge pull request #50383 from thaJeztah/no_inspect_with_size
integration/container: use subtests in some places, add separate test for ContainerInspectWithRaw
2025-07-11 23:20:31 +02:00
Sebastiaan van Stijn
c7f02581b7 Merge pull request #50391 from robmry/no_error_on_stopped_userland_proxy
Don't log a warning when stopping a stopped docker-proxy
2025-07-11 23:17:38 +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
Rob Murray
c31368fffb Don't raise an error when stopping a stopped docker-proxy
Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-07-11 18:29:25 +01:00
Abubacarr Ceesay
f6b3b257c8 implement test api images history integration test on dedicated file
Signed-off-by: Abubacarr Ceesay <abubacarr671@gmail.com>
2025-07-11 19:04:37 +02:00
Abubacarr Ceesay
669163c416 remove test api images history integration cli test suite
Signed-off-by: Abubacarr Ceesay <abubacarr671@gmail.com>
2025-07-11 19:03:19 +02:00
Sebastiaan van Stijn
ca3e884c4d Merge pull request #50378 from thaJeztah/container_remove_deprecated
daemon/container: remove deprecated types and functions
2025-07-11 18:23:23 +02:00
Rob Murray
d52edeba07 Merge pull request #50358 from robmry/nftables_iptables_switching
Remove iptables rules when using nftables, and vice-versa
2025-07-11 16:41:23 +01:00
Rob Murray
16c886402d Merge pull request #50388 from robmry/fix_nftablesdoc_results
Fix expected results for nftablesdoc tests
2025-07-11 16:38:39 +01:00
Sebastiaan van Stijn
eb8c54cba5 Merge pull request #50377 from thaJeztah/graphdriver_cleanups
daemon/graphdriver: remove deprecated GetDriver(), redundant `init()`, and leftovers for graphdriver-plugins
2025-07-11 17:17:48 +02:00
Abubacarr Ceesay
04dbcddd6a migrate test api images history integration cli test to integration test
Signed-off-by: Abubacarr Ceesay <abubacarr671@gmail.com>
2025-07-11 17:16:31 +02:00
Sebastiaan van Stijn
99595adf51 Merge pull request #50385 from thaJeztah/client_add_raw_test
client: TestContainerInspectWithEmptyID test both inspect variants
2025-07-11 17:12:59 +02:00
Rob Murray
d51b0dd786 Merge pull request #50376 from thaJeztah/registry_deprecated_fields
registry: remove deprecated APIEndpoint fields
2025-07-11 15:53:06 +01:00
Rob Murray
b74c1dcca0 Merge pull request #50375 from thaJeztah/api_registry_remove_nondistributable
api/types/registry: remove deprecated fields for non-distributable artifacts
2025-07-11 15:52:10 +01:00
Rob Murray
f44f309edc Merge pull request #50374 from thaJeztah/registry_deprecated_ResolveRepository
registry: remove deprecated Service.ResolveRepository()
2025-07-11 15:51:53 +01:00
Rob Murray
adad33b30e Fix expected results for nftablesdoc tests
Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-07-11 15:32:52 +01:00
Sebastiaan van Stijn
dde698a2e8 integration/container: add basic test for ContainerInspectWithRaw
Make sure we have basic coverage for this function; integration-cli may
have additional tests covering this as well.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-11 15:00:19 +02:00
Sebastiaan van Stijn
16ed75572f client: TestContainerInspectWithEmptyID test both inspect variants
Test both ContainerInspect and ContainerInspectWithRaw

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-11 14:52:23 +02:00
Rob Murray
2837112c8e Merge pull request #50355 from robmry/nftablesdoc
Add "nftablesdoc"
2025-07-11 13:01:32 +01:00
Paweł Gronowski
c47a4ab498 Merge pull request #50356 from robmry/nftables_ci
Run nftables in CI
2025-07-11 13:36:22 +02:00
Rob Murray
7f602d3b94 When switching between iptables/nftables, delete old rules
Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-07-11 12:35:28 +01:00
Sebastiaan van Stijn
a5e3f39770 integration/container: avoid ContainerInspectWithRaw with "size"
These tests didn't use the raw output, and didn't use the size.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-11 13:01:56 +02:00
Sebastiaan van Stijn
88b67eb2fc integration/container: cleanup TestCreateWithCustomReadonlyPaths
- Use ContainerInspect instead of manually unmarshaling the raw JSON
- Explicitly stop the container instead of polling for it to die
- Add test for privileged containers
- Use subtests and run parallel

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-11 12:51:54 +02:00
Sebastiaan van Stijn
bd091c1a9d integration/container: cleanup TestCreateWithCustomMaskedPaths
- Use ContainerInspect instead of manually unmarshaling the raw JSON
- Explicitly stop the container instead of polling for it to die
- Use subtests and run parallel

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-11 12:51:30 +02:00
Rob Murray
0d189dd4e1 Merge pull request #50321 from robmry/simplify_gateway_programming
Simplify gateway programming
2025-07-11 10:47:03 +01:00
Rob Murray
779052873d Add nftablesdoc
Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-07-11 09:36:08 +01:00
Sebastiaan van Stijn
ad579b8a1d daemon/container: remove deprecated IsValidStateString
This was deprecated in 44b653ef99, which
was part of v28.2, but the container package was moved inside the daemon
in 5419eb1efc, so these aliases were no
longer useful.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-11 01:47:24 +02:00
Sebastiaan van Stijn
312eebde49 daemon/container: remove deprecated IsValidHealthString
This was deprecated in df662ebc59, which
was part of v28.2, but the container package was moved inside the daemon
in 5419eb1efc, so these aliases were no
longer useful.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-11 01:42:10 +02:00
Sebastiaan van Stijn
e9fb208e87 daemon/container: remove deprecated StateStatus, WaitCondition
These were deprecated in 100102108b, which
was part of v28.2, but the container package was moved inside the daemon
in 5419eb1efc, so these aliases were no
longer useful.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-11 01:42:05 +02:00
Sebastiaan van Stijn
0d24798529 daemon/graphdriver: remove error or deprecated graphdriver-plugins
This error was added in 555dac5e14 to produce
an error for the deprecated graphdriver-plugins.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-11 01:24:39 +02:00
Sebastiaan van Stijn
7767525ccd daemon/graphdriver: remove deprecated GetDriver()
This was deprecated in 84cabde357, which
was part of v28.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-11 01:16:46 +02:00
Sebastiaan van Stijn
1fe4a0a7ad daemon/graphdriver: remove redundant init()
This was added in a63ff8da46, but looks
like the only reason was to just have the var initialized, so let's
do so when we create the var.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-11 01:10:47 +02:00
Akihiro Suda
1b072f717a Merge pull request #50371 from thaJeztah/push_auth_body
daemon/server: remove compatibility with API v1.4 auth-config on push
2025-07-11 07:22:38 +09:00
Sebastiaan van Stijn
bd8f9c3c1b registry: remove deprecated APIEndpoint.AllowNondistributableArtifacts
This field was deprecated in 1932091e21,
which is part of v28.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-11 00:17:29 +02:00
Sebastiaan van Stijn
65d424e126 registry: remove deprecated APIEndpoint.Official
This field was deprecated in d8fa2f8071,
which is part of v28.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-11 00:17:22 +02:00
Sebastiaan van Stijn
7252c3c78d registry: remove deprecated APIEndpoint.TrimHostName
This field was deprecated in 3014d6d7a3,
which is part of v28.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-11 00:01:20 +02:00
Sebastiaan van Stijn
11a18d3b00 api/types/registry: remove deprecated fields for non-distributable artifacts
These fields were deprecated in 1932091e21,
which is part of v28. They were kept in place for responses in older API
versions, but no longer used since 7d9c50db2b,
which implemented a fallback without requiring the fields to be present.

This patch:

- removes `ServiceConfig.AllowNondistributableArtifactsCIDRs`
- removes `ServiceConfig.AllowNondistributableArtifactsHostnames`

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-10 23:47:43 +02:00
Sebastiaan van Stijn
b3e513f80a registry: remove deprecated Service.ResolveRepository()
It was deprecated in 6c643bc366, which is
part of v28, and had no external consumers.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-10 23:19:13 +02:00
Sebastiaan van Stijn
5862b926f5 registry: remove deprecated SetCertsDir and unify CertsDir code
This was deprecated in b633c4cc33, which was
in v28, and no longer has any consumer, so we can remove it.

Now that we no longer have to synchronise `CertsDir` with `SetCertsDir`
we can also remove the synchronization (`homedir.GetConfigHome()` does
some additional lookups, but those usually are just looking up env-vars,
and `user.Current()` already has a `sync.Once` or equivalent). Also
unifying the platform-specific code to remove some abstraction and put
the logic in plain sight.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-10 22:47:17 +02:00
Sebastiaan van Stijn
924cd22d1d registry: remove deprecated HostCertsDir
This was deprecated in dd7ab0e82b which was
in v28, and no longer has any consumer, so we can remove it.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-10 21:41:25 +02:00
Rob Murray
178416334f Run CI tests with nftables
Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-07-10 19:53:15 +01:00
Rob Murray
d82900dfde Merge pull request #50184 from robmry/nftables_port_rules
nftables: per-port rules
2025-07-10 19:36:27 +01:00
Cory Snider
5de59ca3d9 Merge pull request #50260 from corhere/libn/overlay-fix-logical-races
libnetwork/d/overlay: fix logical race conditions
2025-07-10 14:04:20 -04:00
Cory Snider
0059929d28 Merge pull request #50342 from corhere/libn/fix-networkdb-tombstone-bug
libn/networkdb: stop forging tombstone entries
2025-07-10 13:04:17 -04: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
Albin Kerouanton
aaf3e76ef2 Merge pull request #50344 from corhere/libn/fix-bcast-queue-deadlocks
libnetwork/networkdb: fix broadcast queue deadlocks
2025-07-10 16:22:22 +02:00
Paweł Gronowski
397149482a Merge pull request #50366 from dmcgowan/fix-integration-import-image-dep
Replace integration import test use of image type
2025-07-10 15:15:34 +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
Rob Murray
e8396af484 nftabler: add per-port rules
Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-07-10 10:27:46 +01:00
Sebastiaan van Stijn
d4aa1cf9a9 Merge pull request #50364 from corhere/libn/ov-writetostore-comment
libn/d/overlay: drop obsolete writeToStore comment
2025-07-10 10:13:39 +02:00
Derek McGowan
b677c1a671 Replace integration import test use of image type
This is the only non-daemon import of the image package. The platform
type is also the better type to use.

Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-07-09 21:06:59 -07:00
Cory Snider
d90277372f libn/d/overlay: drop obsolete writeToStore comment
The writeToStore() call was removed from CreateNetwork in
commit 0fa873c0fe. The comment about
undoing the write is no longer applicable.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2025-07-09 16:48:37 -04:00
Albin Kerouanton
20ed15f607 Merge pull request #50340 from akerouanton/split-nat-routed-portmappings
libnet/d/bridge: split NATed and routed port mappings
2025-07-09 22:11:42 +02:00
Rob Murray
30b9480107 Create legacy links during endpoint Join
Legacy links were set up by ProgramExternalConnectivity, but
removed by Leave (rather than RevokeExternalConnectivity). The
options needed by legacy links are all available in Join, and
Join will only be called once per Endpoint. So, create legacy
links there.

Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-07-09 19:42:36 +01:00
Rob Murray
dd9e289b6e Don't pass sandbox options to ProgramExternalConnectivity
The same sandbox options are passed to Join.

Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-07-09 19:42:36 +01:00
Rob Murray
4f7afb8ac9 Remove libnet's logic to track a driver's port mapping state
Change the semantics of ProgramExternalConnectivity, libnet
can now call it whenever an endpoint is selected or deselected
as a container's gateway endpoint.

It's the driver's responsibility to remember what bindings it's
set up, and to work out what needs to change.

So, calling ProgramExternalConnectivity to tell the driver
an endpoint is no longer a gateway has the same effect as
RevokeExternalConnectivity - bindings need to be removed.

That means libnet no longer needs to work out whether to
Program/Revoke, it can just call ProgramExternalConnectivity.
RevokeExternalConnectivity has been removed.

Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-07-09 19:42:36 +01:00
Cory Snider
89d3419093 libnetwork/d/overlay: fix logical race conditions
The concurrency control in the overlay driver is logically unsound.
While the use of mutexes is sufficient to prevent data races --
violations of the Go memory model -- many operations which need to be
atomic are performed with unbounded concurrency.

Overhaul the use of locks in the overlay network driver. Implement sound
locking at the network granularity: operations may proceed concurrently
iff they are being applied to distinct networks. Push the responsibility
of locking up to the code which calls methods or accesses struct fields
to avoid deadlock situations like we had previously with
d.initSandboxPeerDB() and to make the code easier to reason about.

Each overlay network has a distinct peer db. The NetworkDB watch for the
overlay peer table for the network will only start after
(*driver).CreateNetwork returns and will be stopped before libnetwork
calls (*driver).DeleteNetwork, therefore the lifetime of the peer db for
a network is constrained to the lifetime of the network itself. Yet the
peer db for a network is tracked in a dedicated map, separately from the
network objects themselves. This has resulted in a parallel set of
mutexes to manage concurrency of the peer db distinct from the mutexes
for the driver and networks. Move the peer db for a network into a field
of the network struct and guard it from concurrent access using the
per-network lock. Move the methods for manipulating the peer db into the
network struct so that the methods can only be called if the caller has
a reference to the network object.

Network creation and deletion are synchronized using the driver-scope
mutex, but some of the kernel programming is performed outside of the
critical section. It is possible for network deletion to race with
recreating the network, interleaving the kernel programming for the
network creation and deletion, resulting in inconsistent kernel state.
Parallelize network creation and deletion soundly. Use a double-checked
locking scheme to soundly handle the case of concurrent CreateNetwork
and DeleteNetwork for the same network id without blocking operations
on other networks. Synchronize operations on a network so that
operations on the network such as adding a neighbor to the peer db are
performed atomically, not interleaved with deleting the network.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2025-07-09 14:12:59 -04:00
Cory Snider
843cd96725 libn/d/overlay: fix encryption race conditions
There is a dedicated mutex for synchronizing access to the encrMap.
Separately, the main driver mutex is used for synchronizing access to
the encryption keys. Their use is sufficient to prevent data races (if
used correctly, which is not the case) but not logical race conditions.
Programming the encryption parameters for a peer can race with
encryption keys being updated, which could lead to inconsistencies
between the parameters programmed into the kernel and the desired state.

Introduce a new mutex for synchronizing encryption operations. Use that
mutex to synchronize access to both encrMap and keys. Handle encryption
key updates in a critical section so they can no longer be interleaved
with kernel programming of encryption parameters.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2025-07-09 14:12:26 -04:00
Cory Snider
a1d299749c libn/d/overlay: inline secMapWalk into only caller
func (*driver) secMapWalk is a curious beast. It is named walk, yet it
also mutates the collection being iterated over. It returns an error,
but that error is always nil. It takes a callback that can break
iteration, yet the only caller makes no use of that affordance. Its
utility is limited and the abstraction hinders readability more than it
helps. Open-code the d.secMap.nodes loop into
func (*driver) updateKeys(), the only caller.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2025-07-09 12:53:20 -04:00
Cory Snider
74713e1a7d libnetwork/d/overlay: un-embed mutexes
It is easier to find all references when they are struct fields rather
than embedded structs.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2025-07-09 12:53:20 -04:00
Paweł Gronowski
674e401519 Merge pull request #50318 from dmcgowan/client-remove-buildkit-dep
Remove client buildkit dep
2025-07-09 12:32:27 +02:00
Albin Kerouanton
10f3491546 Merge pull request #50182 from robmry/nftables_endpoint_rules
nftables: per-endpoint rules
2025-07-09 10:50:37 +02:00
Paweł Gronowski
222610ae13 Merge pull request #50353 from vvoland/update-go
Update to go1.24.5
2025-07-09 01:22:42 +02:00
Albin Kerouanton
a05080c26c libnet/d/bridge: split NATed and routed port mappings
bindHostPorts currently handles both NATed and routed port mappings.
Split this into two separate functions, one for each type of mapping.
This will help split portmappers.

Signed-off-by: Albin Kerouanton <albinker@gmail.com>
2025-07-09 00:05:28 +02:00
Albin Kerouanton
d229c1ba31 libnet/d/bridge: norm pb reqs before forming groups
Port bindings are currently sorted — to form groups that should be
mapped in one go — and then normalized by `configurePortBindingIPv[4|6]`.
However, gw_modes might not be the same for IPv4/v6, so the upcoming
split of NATed / routed portmappers will require that they're processed
independently.

With this commit, PBs are now normalized (by calling the `configure...`
funcs), and then sorted. The sort func is updated to group routed PBs.

`needSamePort` was comparing the container's IP address, but this field
was never set by the time it's called. Now it's set, and has a different
value when IPv4 / IPv6 portmappings are mixed, so remove it from the
comparison.

Signed-off-by: Albin Kerouanton <albinker@gmail.com>
2025-07-09 00:05:28 +02:00
Albin Kerouanton
bc97e2820d Merge pull request #50307 from akerouanton/sctp-filelistener
libnet/d/bridge: pass SCTP sock to the proxy
2025-07-09 00:04:27 +02:00
Rob Murray
e2034267f6 nftabler: add per-endpoint rules
Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-07-08 19:43:34 +01:00
Albin Kerouanton
b5bf89c315 libnet/d/bridge: pass SCTP sock to the proxy
Since commit b3fabedec, the bridge driver maps ports following a 3-step
process: 1. create a socket, and bind it to the host port; 2. create
iptables rules; 3. start the userland proxy (if it's enabled). This
ensures that the port is really free before inserting iptables rules
that could otherwise disrupt host services.

However, this 3-step process wasn't implemented for SCTP, because we had
no way to instiantiate an SCTP listener from an fd. Since
github.com/ishidawataru/sctp@4719921f9, we can.

Signed-off-by: Albin Kerouanton <albinker@gmail.com>
2025-07-08 20:07:22 +02:00
Paweł Gronowski
5c9e4c5d0b Merge pull request #50316 from corhere/libn/networkdb-wireshark
contrib: add Wireshark plugins for NetworkDB
2025-07-08 19:31:26 +02:00
Paweł Gronowski
0a047e825c update to go1.24.5
- https://github.com/golang/go/issues?q=milestone%3AGo1.24.5+label%3ACherryPickApproved
- full diff: https://github.com/golang/go/compare/go1.24.4...go1.24.5

This minor releases include 1 security fixes following the security policy:

- cmd/go: unexpected command execution in untrusted VCS repositories

    Various uses of the Go toolchain in untrusted VCS repositories can result in
    unexpected code execution. When using the Go toolchain in directories fetched
    using various VCS tools (such as directly cloning Git or Mercurial repositories)
    can cause the toolchain to execute unexpected commands, if said directory
    contains multiple VCS configuration metadata (such as a '.hg' directory in a Git
    repository). This is due to how the Go toolchain attempts to resolve which VCS
    is being used in order to embed build information in binaries and determine
    module versions.

    The toolchain will now abort attempting to resolve which VCS is being used if it
    detects multiple VCS configuration metadata in a module directory or nested VCS
    configuration metadata (such as a '.git' directoy in a parent directory and a
    '.hg' directory in a child directory). This will not prevent the toolchain from
    building modules, but will result in binaries omitting VCS related build
    information.

    If this behavior is expected by the user, the old behavior can be re-enabled by
    setting GODEBUG=allowmultiplevcs=1. This should only be done in trusted
    repositories.

    Thanks to RyotaK (https://ryotak.net) of GMO Flatt Security Inc for reporting
    this issue.

    This is CVE-2025-4674 and https://go.dev/issue/74380.

View the release notes for more information:
https://go.dev/doc/devel/release#go1.24.5

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-07-08 19:21:37 +02:00
Sebastiaan van Stijn
836bd72114 Merge pull request #50347 from thaJeztah/windows_networking_deflake
integration/networking: increase context timeout for attach
2025-07-08 16:50:42 +02:00
Sebastiaan van Stijn
20c0fe24f5 Merge pull request #50086 from vvoland/vendor-clock
vendor: code.cloudfoundry.org/clock v1.37.0
2025-07-08 16:37:30 +02:00
Sebastiaan van Stijn
963e7e6595 Merge pull request #50179 from thaJeztah/windows_updates
gha: update to windows 2022 / 2025
2025-07-08 15:28:23 +02:00
Rob Murray
266d10a075 Merge pull request #50181 from robmry/nftables_network_rules
nftables: per-network rules
2025-07-08 14:11:13 +01:00
Sebastiaan van Stijn
0ea28fede0 integration/networking: increase context timeout for attach
The TestNatNetworkICC and TestFlakyPortMappedHairpinWindows (TestPortMappedHairpinWindows)
tests were frequently failing on Windows with a context timeout;

    === FAIL: github.com/docker/docker/integration/networking TestNatNetworkICC/User_defined_nat_network (9.67s)
        nat_windows_test.go:62: assertion failed: error is not nil: Post "http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.51/containers/4357bd24c9b77b955ee961530d1f552ce099b3dcbeb396db599971b2396d8b08/start": context deadline exceeded
        panic.go:636: assertion failed: error is not nil: Error response from daemon: error while removing network: network mynat has active endpoints (name:"ctr2" id:"dc8d597dafef")

    === FAIL: github.com/docker/docker/integration/networking TestNatNetworkICC (18.34s)

    === FAIL: github.com/docker/docker/integration/networking TestFlakyPortMappedHairpinWindows (13.02s)
        nat_windows_test.go:110: assertion failed: error is not nil: Post "http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.51/containers/65207ae3d6953d85cd2123feac45af60b059842d570d4f897ea53c813cba3cb4/start": context deadline exceeded
        panic.go:636: assertion failed: error is not nil: Error response from daemon: error while removing network: network clientnet has active endpoints (name:"amazing_visvesvaraya" id:"18add58d415e")

These timeouts were set in c1ab6eda4b and
2df4391473, and were shared between Linux
and Windows; likely Windows is slower to start, so these timeouts to be
expected.

Let's increase the context timeout to give it a bit more time.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-08 14:18:37 +02:00
Sebastiaan van Stijn
1de9f39f2c Merge pull request #50343 from corhere/libn/networkdb-rejoin-tests
libnetwork/networkdb: make TestNetworkDBIslands not flaky
2025-07-08 12:34:50 +02:00
Albin Kerouanton
c833bd598e vendor: github.com/ishidawataru/sctp v0.0.0-20250708014235-1989182a9425
Signed-off-by: Albin Kerouanton <albinker@gmail.com>
2025-07-08 12:33:18 +02:00
Paweł Gronowski
03a662b80e vendor: code.cloudfoundry.org/clock v1.37.0
full diff: https://github.com/cloudfoundry/clock/compare/v1.1.0...v1.37.0

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-07-08 10:41:18 +02:00
Sebastiaan van Stijn
b47847e139 Merge pull request #50336 from thaJeztah/remove_libtrust
distribution: fix detection of v1 images and remove libtrust dependency
2025-07-08 10:38:28 +02:00
Cory Snider
08bde5edfa libnetwork/networkdb: fix broadcast queue deadlocks
NetworkDB's JoinNetwork function enqueues a message onto a
TransmitLimitedQueue while holding the NetworkDB mutex locked for
writing. The TransmitLimitedQueue has its own synchronization;
it locks its mutex when enqueueing a message. Locking order:
  1. (NetworkDB).RWMutex.Lock()
  2. (TransmitLimitedQueue).mu.Lock()

NetworkDB's gossip periodic task calls GetBroadcasts on the same
TransmitLimitedQueue to retrieve the enqueued messages. GetBroadcasts
invokes the queue's NumNodes callback while the mutex is locked. The
NumNodes callback function that NetworkDB sets locks the NetworkDB mutex
for reading to take the length of the nodes map. Locking order:
  1. (TransmitLimitedQueue).mu.Lock()
  2. (NetworkDB).RWMutex.RLock()

If one goroutine calls GetBroadcasts on the queue concurrently with
another goroutine calling JoinNetwork on the NetworkDB, the goroutines
may deadlock due to the lock inversion.

Fix the deadlock by caching the number of nodes in an atomic variable so
that the NumNodes callback can load the value without blocking or
violating Go's memory model. And fix a similar deadlock situation with
the table-event broadcast queues.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2025-07-07 15:45:29 -04:00
Sebastiaan van Stijn
1284a44efa Merge pull request #50328 from thaJeztah/rm_LogReleaseMetadata
layer: remove LogReleaseMetadata utility
2025-07-07 21:27:04 +02:00
Sebastiaan van Stijn
42701c5406 Merge pull request #50335 from thaJeztah/less_distribution
integration-cli: remove uses of legacy distribution types
2025-07-07 21:26:14 +02:00
Sebastiaan van Stijn
0e40c2546f Merge pull request #50337 from thaJeztah/pkg_plugin_no_distribution
daemon/pkg/plugin: remove dependency on legacy distribution package
2025-07-07 21:25:45 +02:00
Cory Snider
aff444df86 libn/networkdb: make TestNetworkDBIslands not flaky
With rejoinClusterBootStrap fixed in tests, split clusters should
reliably self-heal in tests as well as production. Work around the other
source of flakiness in TestNetworkDBIslands: timing out waiting for a
failed node to transition to gracefully left. This flake happens when
one of the leaving nodes sends its NodeLeft message to the other leaving
node, and the second is shut down before it has a chance to rebroadcast
the message to the remaining nodes. The proper fix would be to leverage
memberlist's own bookkeeping instead of duplicating it poorly with user
messages, but doing so requires a change in the memberlist module.
Instead have the test check that the sum of failed+left nodes is
expected instead of waiting for all nodes to have failed==3 && left==0.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2025-07-07 14:09:01 -04:00
Cory Snider
1e1be54d3e libn/networkdb: prevent spurious rejoins in tests
The rejoinClusterBootStrap periodic task rejoins with the bootstrap
nodes if none of them are members of the cluster. It correlates the
cluster nodes with the bootstrap list by comparing IP addresses,
ignoring ports. In normal operation this works out fine as every node
has a unique IP address, but in unit tests every node listens on a
distinct port of 127.0.0.1. This situation causes the check to
incorrectly filter out all nodes from the list, mistaking them for the
local node.

Filter out the local node using pointer equality of the *node to avoid
any ambiguity. Correlate the remote nodes by IP:port so that the check
behaves the same in tests and in production.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2025-07-07 14:09:01 -04:00
Cory Snider
21d9109750 libn/networkdb: stop forging tombstone entries
When a node leaves a network, all entries owned by that node are
implicitly deleted. The other NetworkDB nodes handle the leave by
setting the deleted flag on the entries owned by the left node in their
local stores. This behaviour is problematic as it results in two
conflicting entries with the same Lamport timestamp propagating
through the cluster.

Consider two NetworkDB nodes, A, and B, which are both joined to some
network. Node A in quick succession leaves the network, immediately
rejoins it, then creates an entry. If Node B processes the
entry-creation event first, it will add the entry to its local store
then set the deleted flag upon processing the network-leave. No matter
how many times B bulk-syncs with A, B will ignore the live entry for
having the same timestamp as its local tombstone entry. Once this
situation occurs, the only way to recover is for the entry to get
updated by A with a new timestamp.

There is no need for a node to store forged tombstones for another
node's entries. All nodes will purge the entries naturally when they
process the network-leave or node-leave event. Simply delete the
non-owned entries from the local store so there is no inconsistent state
to interfere with convergence when nodes rejoin a network. Have nodes
update their local store with tombstones for entries when leaving a
network so that after a rapid leave-then-rejoin the entry deletions
propagate to nodes which may have missed the leave event.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2025-07-07 12:24:53 -04:00
Rob Murray
428dbe617a nftabler: add network level rules
Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-07-07 13:49:35 +01:00
Rob Murray
a55fede2d4 Pass context to nftables functions
Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-07-07 13:46:45 +01:00
Rob Murray
1c5d6d1ee3 Mark iptabler/nftabler golden results as generated
Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-07-07 13:46:45 +01:00
Sebastiaan van Stijn
ee6a6b061f daemon/pkg/plugin: remove dependency on legacy distribution package
Use the media-types defined in containerd, and create a local copy
of the media-type for plugins, which is not defined in either the
OCI or containerd package.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-05 21:19:40 +02:00
Sebastiaan van Stijn
09689298e3 distribution: fix detection of v1 images and remove libtrust dependency
The current detection based on mediaType only accounted for the non-signed
mediatype (`application/vnd.docker.distribution.manifest.v1+json`), but
most (if not all) v1 images used the "signed" manifest type; for example;

    docker buildx imagetools inspect docker:1.0.1
    Name:      docker.io/library/docker:1.0.1
    MediaType: application/vnd.docker.distribution.manifest.v1+prettyjws
    Digest:    sha256:666987df8e0c46670ea52bcd078547297a738fd6b421ec77aac910e1c0f688fd

Various code-paths would still detect the unsupported type through type-
matching the `*schema1.SignedManifest` type, but given that the only reason
for this is to detect whether the image is supported, we might as well just
match the mediaType.

Unfortunately, the [containerd images package][1] currently only defines a
const for the signed variant, and not for the unsigned ones, so to remove
the dependency on the `schema1` package, this patch introduces a (temporary)
local definition.

With this patch, the dependency on the "schema1" package is removed, and with
that also the use of "libtrust"; the dependency still shows up in vendor.mod
due to the docker/distribution dependency not being a go module, but should
dissolve once we remove that dependency in future.

This patch can also be verified using the `distribution` endpoint, which
returns an error when trying to get information for a "v1" image;

    curl -v --unix-socket /var/run/docker.sock 'http://localhost/v1.51/distribution/docker.io/library/docker:1.0.1/json'
    *   Trying /var/run/docker.sock:0...
    * Connected to localhost (/var/run/docker.sock) port 80 (#0)
    > GET /v1.51/distribution/docker.io/library/docker:1.0.1/json HTTP/1.1
    > Host: localhost
    > User-Agent: curl/7.88.1
    > Accept: */*
    >
    < HTTP/1.1 400 Bad Request
    < Api-Version: 1.51
    < Content-Type: application/json
    < Docker-Experimental: false
    < Ostype: linux
    < Server: Docker/dev (linux)
    < Date: Sat, 05 Jul 2025 17:00:18 GMT
    < Content-Length: 311
    {"message":"Docker Image Format v1 and Docker Image manifest version 2, schema 1 support has been removed. Suggest the author of docker.io/library/docker:1.0.1 to upgrade the image to the OCI Format or Docker Image manifest v2, schema 2. More information at https://docs.docker.com/go/deprecated-image-specs/"}

    curl -v --unix-socket /var/run/docker.sock 'http://localhost/v1.51/distribution/docker.io/library/docker:28/json'
    *   Trying /var/run/docker.sock:0...
    * Connected to localhost (/var/run/docker.sock) port 80 (#0)
    > GET /v1.51/distribution/docker.io/library/docker:28/json HTTP/1.1
    > Host: localhost
    > User-Agent: curl/7.88.1
    > Accept: */*
    >
    < HTTP/1.1 200 OK
    < Api-Version: 1.51
    < Content-Type: application/json
    < Docker-Experimental: false
    < Ostype: linux
    < Server: Docker/dev (linux)
    < Date: Sat, 05 Jul 2025 17:01:06 GMT
    < Content-Length: 541
    {"Descriptor":{"mediaType":"application/vnd.oci.image.index.v1+json","digest":"sha256:0a2ee60851e1b61a54707476526c4ed48cc55641a17a5cba8a77fb78e7a4742c","size":5165},"Platforms":[{"architecture":"amd64","os":"linux"},{"architecture":"unknown","os":"unknown"},{"architecture":"arm","os":"linux","variant":"v6"},{"architecture":"unknown","os":"unknown"},{"architecture":"arm","os":"linux","variant":"v7"},{"architecture":"unknown","os":"unknown"},{"architecture":"arm64","os":"linux","variant":"v8"},{"architecture":"unknown","os":"unknown"}]}

[1]: https://github.com/containerd/containerd/blob/v2.1.3/core/images/mediatypes.go#L54-L55

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-05 19:57:10 +02:00
Sebastiaan van Stijn
ac9d5a6068 integration-cli: TestPullFailsWithAlteredLayer: use OCI manifest
The OCI types should be able to unmarshal the image manifest (regardless
if it was created from the legacy distribution types or otherwise), so
we can drop the use of the legacy distribution types here.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-05 17:56:35 +02:00
Sebastiaan van Stijn
fd47ccef7b integration-cli: TestPullFailsWithAlteredManifest: use OCI manifest
The OCI types should be able to unmarshal the image manifest (regardless
if it was created from the legacy distribution types or otherwise), so
we can drop the use of the legacy distribution types here.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-05 17:52:48 +02:00
Sebastiaan van Stijn
4e818970e2 integration-cli: TestPullManifestList: use OCI media-types
This test is verifying that push/pull works; current versions of the registry
used should support both the legacy (docker distribution) and OCI media-types,
so let's use the OCI types.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-05 17:48:48 +02:00
Sebastiaan van Stijn
f6ef56a0bc integration-cli: TestPullManifestList: rewrite using OCI types
Trying to reduce the places where we depend on the legacy distribution
dependency. For this test, we used it to generate the JSON for a manifest-list,
which we can do with the OCI types as well.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-05 17:44:50 +02:00
Sebastiaan van Stijn
83264918d3 Merge pull request #50333 from fussybeaver/50331-swagger-gwpriority-integer
api: swagger: Tweak type of GwPriority to integer
2025-07-05 17:16:41 +02:00
Niel Drummond
51d6687754 api: swagger: Tweak type of GwPriority to integer
Signed-off-by: Niel Drummond <niel@drummond.lu>
2025-07-05 14:47:50 +01:00
Niel Drummond
bfc0c7cff5 docs: api: Tweak type of GwPriority to integer
Signed-off-by: Niel Drummond <niel@drummond.lu>
2025-07-05 14:46:12 +01:00
Sebastiaan van Stijn
73c199f215 Merge pull request #50323 from thaJeztah/use_oci_identity
deprecate layer.CreateChainID for OCI identity
2025-07-05 15:39:00 +02:00
Sebastiaan van Stijn
557b5d60d3 layer: remove LogReleaseMetadata utility
Inline the code where used to allow producing logs customized to the
code-path performing the cleanup.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-04 18:27:01 +02:00
Sebastiaan van Stijn
7d18f65eb2 distribution/xfer: improve test reporting
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-04 17:12:34 +02:00
Sebastiaan van Stijn
291872e086 remove type conversions
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-04 17:12:34 +02:00
Sebastiaan van Stijn
ade244f97d deprecate layer.CreateChainID for OCI identity
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-04 17:12:31 +02:00
Brian Goff
8652cf6920 Merge pull request #50324 from thaJeztah/rm_legacy_load 2025-07-04 07:39:19 -07:00
Sebastiaan van Stijn
10e9ab66f9 image/tarexport: inline validateManifest utility
It was just checking if a value is nil; no need to maintain a utility
for that.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-04 11:49:29 +02:00
Sebastiaan van Stijn
471f173170 image/tarexport: improve error messages for invalid archives
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-04 11:49:02 +02:00
Sebastiaan van Stijn
033750cf80 image/tarexport: remove suport for loading v0/v1 images
This removes the tarexporter.legacyLoadImage method and related helpers.
This functionality was added in 01ba0a935b
(docker v1.10), which introduced the new content-addressable image
format; this code provided backward-compatibility with older archives
which contained v0/v1 images.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-04 11:48:52 +02:00
Cory Snider
ebfafa1561 contrib: add Wireshark plugins for NetworkDB
Contribute a Wireshark plugin for decrypting and dissecting
hashicorp/memberlist messages. And contribue a plugin for dissecting the
NetworkDB messages transported as memberlist User messages.

Add a feature to NetworkDB to log the encryption keys to a file for the
Wireshark memberlist plugin to consume, configured using an environment
variable.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2025-07-03 17:58:19 -04:00
Rob Murray
242916b3f9 Merge pull request #45415 from thaJeztah/test_TestPushToCentralRegistryUnauthorized
integration-cli: debug TestPushToCentralRegistryUnauthorized
2025-07-03 14:16:56 +01:00
Sebastiaan van Stijn
a8bcd0db55 Merge pull request #50314 from thaJeztah/gha_rm_go_version_arg
gha: remove GO_VERSION build-arg from builds
2025-07-03 09:59:18 +02:00
Albin Kerouanton
1e1711d405 Merge pull request #50283 from robmry/gatewayness_visible_to_libnet_drivers
Tell libnet's drivers which endpoints have been selected as gateways
2025-07-03 08:22:18 +02:00
Akihiro Suda
c1e6edb7ee Merge pull request #50312 from thaJeztah/image_rootfs_clone
image: RootFS.Clone: simplify
2025-07-03 11:33:55 +09:00
Akihiro Suda
27fc271ef5 Merge pull request #50315 from thaJeztah/bump_gotestsum
Dockerfile: bump gotest.tools/gotestsum v1.12.3 (for go1.25)
2025-07-03 11:32:50 +09:00
Akihiro Suda
166f02ad14 Merge pull request #50317 from dmcgowan/client-test-cleanup
Replace use of env test util with standard library call
2025-07-03 11:32:28 +09:00
Derek McGowan
aae26b80fe Remove client buildkit dep
Remove unused package from client which brings in buildkit dep

Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-07-02 16:08:15 -07:00
Derek McGowan
e93e15afb0 Replace use of env test util with standard library call
As of Go 1.17, `Setenv` can be used to set environment variables
specific to a single test. This also removes a package which gets
vendored just for this.

Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-07-02 15:34:01 -07:00
Sebastiaan van Stijn
4754c15e2b Dockerfile: bump gotest.tools/gotestsum v1.12.3 (for go1.25)
full diff: https://github.com/gotestyourself/gotestsum/compare/v1.12.0...v1.12.3

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-02 23:13:03 +02:00
Sebastiaan van Stijn
fa4f3c979f gha: remove GO_VERSION build-arg from builds
The same env-var is used for action/setup-go as for overriding
the default Go version in Dockerfiles, however action/setup-go
only accepts SemVer (e.g. 1.25.0-rc.1) whereas the official golang
image follows the Go project's versioning, which doesn't use
a SemVer-compatible format (go1.25rc1 / 1.25rc1).

Trying to use the same "GO_VERSION" value for both will therefore
fail.

As we're already updating the default version in the Dockerfile to
the version we want to use, let's remove the --build-arg, and use
the default that's set in the Dockerfile.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-02 22:31:39 +02:00
Sebastiaan van Stijn
3b50d0dbdc Merge pull request #50311 from thaJeztah/stack_ignore_errs
pkg/stack: suppress some unhandled errors
2025-07-02 21:55:55 +02:00
Sebastiaan van Stijn
136c0e591b image: RootFS.Clone: simplify
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-02 17:36:48 +02:00
Sebastiaan van Stijn
c64178d612 Merge pull request #50303 from thaJeztah/xfer_remove_arg
distribution/xfer: LayerDownloadManager.Download: remove initialRootFS arg
2025-07-02 17:36:01 +02:00
Rob Murray
90ba723280 Merge pull request #50310 from akerouanton/drop-libnet-diag-stackdump-handler
libnet/diag: remove /stackdump endpoint
2025-07-02 16:01:45 +01:00
Sebastiaan van Stijn
aea776332b pkg/stack: suppress some unhandled errors
Keeping my IDE happy

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-02 16:02:04 +02:00
Albin Kerouanton
e32d26cb59 libnet/diag: remove /stackdump endpoint
This endpoint was useful when libnetwork was a standalone component that
could be integrated with other products, but now that libnetwork is part
of moby/moby, and considered an internal package, we're sure that the
Engine's SIGUSR1 handler is available to dump stack traces. No need
to keep a duplicate feature.

Moreover, this endpoint is only available over an HTTP server listening
on 127.0.0.1 (hardcoded), and the stackdump is always written to the
disk. So, to have use of it, you need access to the host anyway.

Finally, unlike the Engine's SIGUSR1 handler, this endpoint write stack
traces to `/tmp` and not to the daemon's `--data-root`.

This is a non-core feature, there's an alternative available, it's not
documented in libnetwork/cmd/diagnostic/README.md (which is the
only place that mentions the diag server AFAIK), and the diag client
doesn't support it, so drop it unceremoniously.

Signed-off-by: Albin Kerouanton <albinker@gmail.com>
2025-07-02 15:16:51 +02:00
Sebastiaan van Stijn
c463c3295f Merge pull request #50306 from thaJeztah/image_rm_legacy_handling
image: remove special handling for legacy "layers+base" windows images
2025-07-02 12:54:04 +02:00
Sebastiaan van Stijn
106d8e1ad5 Merge pull request #50287 from thaJeztah/less_loopie
builder/dockerfile: BuildFromConfig: combine loops
2025-07-02 12:52:47 +02:00
Rob Murray
a881e9e057 Remember port binding state in the bridge driver
When ProgramExternalConnectvity is called, the bridge driver
works out whether it needs to add port bindings for an endpoint
based on whether it was selected as the container's gateway.

Remember whether IPv4/IPv6 bindings have been set up, as part
of the endpoint's state. When ProgramExternalConnectivity is
called again, use differences between that stored state and
the newly requested state to decide whether to add bindings.

Port binding state is not persisted, on live-restore port
bindings are re-created (so, the initial state should always
be that no port bindings are set up).

Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-07-02 11:40:29 +01:00
Sebastiaan van Stijn
dab8341a87 Merge pull request #50294 from thaJeztah/listeners_doc_permissions
daemon/listeners: extract utility for DACL, and improve docs
2025-07-02 11:47:02 +02:00
Rob Murray
7ea50c14d6 Remote network driver: remember gateway state
In the remote network driver's ProgramExternalConnectivity,
remember whether endpoints have already been configured as
gateways - so that it's ok for libnetwork to call it more
than once with the same configuration (without passing on
those calls to the actual network driver in HTTP requests).

There's no need to persist this data, even on live-restore
ProgramExternalConnectivity will be called again.

Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-07-02 10:21:31 +01:00
Rob Murray
054738bce3 Pass gateway endpoint ids to ProgramExternalConnectivity
Moving towards making it the network driver's responsibility
to work out whether it should set up port bindings, based on
libnet's gateway selection.

This first step lets the driver know whether an endpoint has
been selected as the container's gateway, allowing the driver
to work out whether mappings between IPv6 host addresses and
IPv4 container addresses are required (when supported).

Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-07-02 10:16:07 +01:00
Sebastiaan van Stijn
3805bbf913 Merge pull request #50305 from tonistiigi/update-buildkit-v0.23.2
vendor: update buildkit to v0.23.2
2025-07-02 10:46:34 +02:00
Sebastiaan van Stijn
07e5be0a18 image: remove special handling for legacy "layers+base" windows images
This special case was added in 540c8e9b20 to
handle situations where a Windows daemon would still have images in legacy
format on Disk.

For legal reasons, Windows base-images were not allowed to be distributed
through registries, and because of that had to be pre-loaded on the host.
Such images would have a RootFS with a special `layers+base` type.

This type is no longer used and [removed from the OCI image spec][1], which
now only allows a single type ("Layers"); from the [OCI image-spec][2]:

> - **rootfs** _object_, REQUIRED
>
>   The rootfs key references the layer content addresses used by the image.
>   This makes the image config hash depend on the filesystem hash.
>
>     - **type** _string_, REQUIRED
>
>       MUST be set to `layers`.
>       Implementations MUST generate an error if they encounter a unknown value while verifying or unpacking an image.

The special handling was added in 2016 to help in the transition, but
it's very unlikely such images still exist, so we can remove the special
handling.

This reverts commit 540c8e9b20.

[1]: https://github.com/opencontainers/image-spec/pull/211
[2]: https://github.com/opencontainers/image-spec/blob/v1.1.1/config.md#properties

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-02 10:40:28 +02:00
Tonis Tiigi
5efd2286da vendor: update buildkit to v0.23.2
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2025-07-01 20:33:42 -07:00
Tianon Gravi
ab92fc4524 Merge pull request #50297 from thaJeztah/remove_contrib_mkimage
contrib: remove mkimage-xxx scripts
2025-07-01 14:25:47 -07:00
Sebastiaan van Stijn
7f69ff5c56 Merge pull request #50302 from thaJeztah/import_aliases
fix some inconsistency in import aliases
2025-07-01 21:59:24 +02:00
Sebastiaan van Stijn
e1b70074ec distribution/xfer: LayerDownloadManager.Download: remove initialRootFS arg
All uses of this method would construct a RootFS from scratch, so we may as
well remove the argument.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-01 21:52:36 +02:00
Sebastiaan van Stijn
173436c702 distribution/xfer: rename var that shadowed type
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-01 21:51:36 +02:00
Sebastiaan van Stijn
0683bc6355 fix some inconsistency in import aliases
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-01 21:48:26 +02:00
Sebastiaan van Stijn
a25cc9d6d0 Merge pull request #50296 from thaJeztah/move_usergroup_to_daemon
internal/usergroup: move to daemon/internal
2025-07-01 21:42:48 +02:00
Sebastiaan van Stijn
9582e205d0 Merge pull request #50299 from thaJeztah/internalize_restartmanager
restartmanager: move to daemon/internal
2025-07-01 21:42:19 +02:00
Sebastiaan van Stijn
fe55b9e54e Merge pull request #50301 from thaJeztah/remove_reports
remove project dev "reports"
2025-07-01 21:41:29 +02:00
Sebastiaan van Stijn
43951937d7 Merge pull request #50298 from thaJeztah/remove_vendoring
remove VENDORING.md
2025-07-01 21:41:08 +02:00
Sebastiaan van Stijn
c8c5dc274e Merge pull request #50300 from thaJeztah/hide_codecov
rename codecov.yml to .codecov.yml
2025-07-01 21:40:49 +02:00
Sebastiaan van Stijn
d207ee97ff daemon/listeners: extract utility for DACL, and improve docs
- Outline the DACL used on Windows.
- Extract constructing the SDDL to a utility, to allow re-using
  for unix sockets in future.
- Improve documentation to mention that Windows allows multiple
  groups and/or users to be given access.

Also removing an intermediate variable.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-01 21:39:52 +02:00
Sebastiaan van Stijn
f4ddb1fd2f Merge pull request #50278 from dmcgowan/api-build-aux
Add progress aux emitter to build backend
2025-07-01 18:03:53 +02:00
Rob Murray
725bc227da Merge pull request #50284 from thaJeztah/remove_deprecated_dockerCmdWithResult
integration-cli: remove uses of deprecated dockerCmdWithResult utility
2025-07-01 15:59:34 +01:00
Sebastiaan van Stijn
18dc570918 remove project dev "reports"
The original intent of this directory was to provide weekly reports
for calls and project meetings, but these haven't been produced for
several Years now (with the most recent report being 8 Years ago).

Let's remove this directory as the information in these reports is
outdated and no longer relevant. If needed, they can still be found
in Git history.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-01 16:42:17 +02:00
Sebastiaan van Stijn
93bbd21d82 rename codecov.yml to .codecov.yml
Make it a hidden file. From the [CodeCov docs][1]:

> Can I name the file .codecov.yml?
>
> Yes, you can name the file `codecov.yml` or `.codecov.yml`. However, the
> file must still be located in the repository root, `dev/`, or `.github/`
> directories

[1]: https://docs.codecov.com/docs/codecov-yaml#can-i-name-the-file-codecovyml

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-01 16:17:17 +02:00
Sebastiaan van Stijn
ce3c8785dc restartmanager: move to daemon/internal
The restartmanager is only used internally by the daemon, and has no external
users. Move it to the daemon/internal package.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-01 16:10:03 +02:00
Sebastiaan van Stijn
256f96ef59 remove VENDORING.md
This document was added to outline our vendoring policies and to describe
versioning. It's obsoleted by Go module's definition, which follows SemVer
and MVS.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-01 16:03:21 +02:00
Sebastiaan van Stijn
717188201a contrib: remove mkimage-xxx scripts
These scripts have not been actively maintained for several Years, are
un-tested, and there may be better alternatives / implementations to
use for this purpose. A search on GitHub only showed a single active
use of one of these scripts; let's remove them, as there are no plans
to maintain (and test) these scripts.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-01 15:51:56 +02:00
Sebastiaan van Stijn
3f8630cb84 internal/usergroup: move to daemon/internal
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-01 15:22:39 +02:00
Sebastiaan van Stijn
cbe6e31487 internal/usergroup: move windows consts to builder/dockerfile
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-01 15:18:27 +02:00
Brian Goff
89eb40858c Merge pull request #50125 from thaJeztah/client_winio_dialpipe
client: use go-winio.DialPipe directly
2025-06-30 12:10:59 -07:00
Rob Murray
9cb179d614 Merge pull request #50106 from corhere/libn/overlay-peerdb-soundness
libnetwork/d/overlay: properly model peer db
2025-06-30 19:13:08 +01:00
Sebastiaan van Stijn
8dbe0f45a9 integration-cli: debug TestPushToCentralRegistryUnauthorized
Seeing some test-failures, which could be due to changes on Docker Hub

    === Failed
    === FAIL: github.com/docker/docker/integration-cli TestDockerCLIPushSuite/TestPushToCentralRegistryUnauthorized (51.08s)
        docker_cli_push_test.go:229: assertion failed: strings.Contains(out, "Retrying") is true

    === FAIL: github.com/docker/docker/integration-cli TestDockerCLIPushSuite (101.49s)

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-06-30 15:44:52 +02:00
Sebastiaan van Stijn
5fe253cd79 builder/dockerfile: BuildFromConfig: combine loops
This function effectively is looping three times over the given commands
to apply to the image. The first two loops did not yet invoke the builder
instance, so we can combine those and execute then before constructing the
builder. We could even consider combining all of them to a single loop, but
keeping it closer to the existing logic or now.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-06-30 15:40:49 +02:00
Sebastiaan van Stijn
de52d67ec0 Merge pull request #50279 from dmcgowan/move-libcontainerd
Move libcontainerd and container under daemon
2025-06-30 13:35:37 +02:00
Sebastiaan van Stijn
a30b63eafc integration-cli: remove uses of deprecated dockerCmdWithResult utility
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-06-30 13:21:30 +02:00
Sebastiaan van Stijn
650ab23785 Merge pull request #49920 from mmorel-35/fix-nakedret
pluginrpc-gen: align generator with generated
2025-06-30 12:18:27 +02:00
Sebastiaan van Stijn
c5b25bf7de Merge pull request #50225 from robmry/TestRoutedNonGateway
Add TestRoutedNonGateway
2025-06-30 11:56:40 +02:00
Derek McGowan
90f9ce14f1 Move libcontainerd to daemon/internal/libcontainerd
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-06-27 14:29:12 -07:00
Derek McGowan
3ee8c1e3a9 Move libcontainerd/types to daemon/internal/libcontainerd/types
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-06-27 14:28:56 -07:00
Derek McGowan
841a369b8f Move libcontainerd/supervisor to daemon/internal/libcontainerd/supervisor
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-06-27 14:28:40 -07:00
Derek McGowan
fe959261d3 Move libcontainerd/shimopts to daemon/internal/libcontainerd/shimopts
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-06-27 14:28:24 -07:00
Derek McGowan
4e8bd050bf Move libcontainerd/remote to daemon/internal/libcontainerd/remote
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-06-27 14:28:08 -07:00
Derek McGowan
dd1656e6bc Move libcontainerd/queue to daemon/internal/libcontainerd/queue
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-06-27 14:27:52 -07:00
Derek McGowan
6835f367e5 Move libcontainerd/local to daemon/internal/libcontainerd/local
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-06-27 14:27:36 -07:00
Derek McGowan
5419eb1efc Move container to daemon/container
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-06-27 14:27:21 -07:00
Derek McGowan
a02ba3c7df Move container/stream to daemon/internal/stream
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-06-27 14:27:05 -07:00
Derek McGowan
9d9cb00d50 Move container/stream/bytespipe to daemon/internal/stream/bytespipe
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-06-27 14:26:49 -07:00
Derek McGowan
3581b982f7 Move plugin to daemon/pkg/plugin
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-06-27 14:26:33 -07:00
Derek McGowan
1c700c876f Move plugin/v2 to daemon/pkg/plugin/v2
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-06-27 14:26:17 -07:00
Derek McGowan
f5ceed8719 Move plugin/executor/containerd to daemon/internal/plugin/executor/containerd
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-06-27 14:26:01 -07:00
Derek McGowan
0b2582dc8f Move internal/metrics to daemon/internal/metrics
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-06-27 14:25:45 -07:00
Sebastiaan van Stijn
3ff85c7343 Merge pull request #50276 from thaJeztah/client_remove_getDockerOS
client: remove getDockerOS utility in favor of "Ostype" header
2025-06-27 19:48:24 +02:00
Sebastiaan van Stijn
8a63d1daa3 Merge pull request #50004 from dmcgowan/move-api-server-packages
Move api server packages to daemon
2025-06-27 19:42:24 +02:00
Sebastiaan van Stijn
b59ba9460c Merge pull request #50256 from thaJeztah/client_auth_RequestAuthConfig
client: omit empty auth headers and use registry.RequestAuthConfig
2025-06-27 19:13:34 +02:00
Derek McGowan
87238882e0 Move api/server to daemon/server
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-06-27 09:18:20 -07:00
Derek McGowan
3a6e3f85c6 Move api/server/backend/build to daemon/build
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-06-27 09:18:05 -07:00
Derek McGowan
79f802d46a Move api/server/httputils to daemon/server/httputils
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-06-27 09:17:49 -07:00
Derek McGowan
c7a87f0dee Move api/server/httpstatus to daemon/server/httpstatus
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-06-27 09:17:33 -07:00
Derek McGowan
d64bd2cceb Move api/server/middleware to daemon/server/middleware
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-06-27 09:17:18 -07:00
Derek McGowan
72a020fcd8 Move api/server/router to daemon/server/router
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-06-27 09:17:02 -07:00
Derek McGowan
f293628f55 Move api/server/router/volume to daemon/server/router/volume
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-06-27 09:16:46 -07:00
Derek McGowan
15c8007064 Move api/server/router/system to daemon/server/router/system
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-06-27 09:16:31 -07:00
Derek McGowan
45172bbf23 Move api/server/router/swarm to daemon/server/router/swarm
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-06-27 09:16:15 -07:00
Derek McGowan
f6ba5a5241 Move api/server/router/session to daemon/server/router/session
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-06-27 09:16:00 -07:00
Derek McGowan
3eb5fe0277 Move api/server/router/plugin to daemon/server/router/plugin
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-06-27 09:15:44 -07:00
Derek McGowan
baa58ddc6a Move api/server/router/network to daemon/server/router/network
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-06-27 09:15:28 -07:00
Derek McGowan
0cbb4ac8e6 Move api/server/router/image to daemon/server/router/image
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-06-27 09:15:13 -07:00
Derek McGowan
a063389af7 Move api/server/router/grpc to daemon/server/router/grpc
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-06-27 09:14:58 -07:00
Derek McGowan
9ff489863c Move api/server/router/distribution to daemon/server/router/distribution
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-06-27 09:14:42 -07:00
Derek McGowan
ced7798ed8 Move api/server/router/debug to daemon/server/router/debug
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-06-27 09:14:26 -07:00
Derek McGowan
3a9db5fbd6 Move api/server/router/container to daemon/server/router/container
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-06-27 09:14:11 -07:00
Sebastiaan van Stijn
fcf3ff1b2f client: remove getDockerOS utility in favor of "Ostype" header
This utility was added in 83b5729f64 to
replace httputils.ParseServerHeader, which was added to print a warning
on Windows in 126529c6d0. At the time, the
only available option to detect the daemon's OS was to parse the `Server`
header, which contained the version of Docker as well as the OS.

However, 7199522ea2 introduced an `OSType`
("Ostype") header that's included on all responses, and a later commit
e9dac5ef5e changed that to also be included
when producing an error for unsupported API versions.

Note that the casing in the midddleware was changed from `OSType` to
`Ostype` (normalized form) in 76a5ca1d4d,
but headers are case-insensitive, and `header.Get()` should handle either
case in the response.

In short; every API response contains an "Ostype" header, which already
contains the OS ("windows" or "linux") that doesn't require any parsing,
so let's put that header to use.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-06-27 18:14:04 +02:00
Derek McGowan
d6136b660f Move api/server/router/checkpoint to daemon/server/router/checkpoint
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-06-27 09:13:55 -07:00
Derek McGowan
31b6886eb1 Move api/server/router/build to daemon/server/router/build
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-06-27 09:13:40 -07:00
Sebastiaan van Stijn
d3dca6e008 Merge pull request #50273 from dmcgowan/api-network-errors
Replace multierror function in network api types
2025-06-27 17:30:06 +02:00
Sebastiaan van Stijn
68ffacf85f Merge pull request #50271 from dmcgowan/client-testutil-dependency
Remove dependency on testutil from client
2025-06-27 13:35:29 +02:00
Sebastiaan van Stijn
fe80dceaa1 Merge pull request #50270 from dmcgowan/client-hijack-test
Remove dependency on httputil for client hijack test
2025-06-27 13:33:01 +02:00
Sebastiaan van Stijn
1c0d381f4e client: client.tryImagePush: accept registry.RequestAuthConfig
Directly accept a privilege-func, and set the auth-header optionally.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-06-27 13:12:50 +02:00
Sebastiaan van Stijn
ca0afe91b9 client: client.tryImageCreate: accept registry.RequestAuthConfig
Directly accept a privilege-func, and set the auth-header optionally.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-06-27 13:12:50 +02:00
Sebastiaan van Stijn
79b4e18883 client: add staticAuth utility
Add a small utility to create a "RequestAuthConfig" from
a static value.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-06-27 13:12:50 +02:00
Sebastiaan van Stijn
871543a8c5 client: Client.ServiceUpdate: don't manually construct header value
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-06-27 13:12:48 +02:00
Derek McGowan
a824db247f Add progress aux emitter to build backend
Avoid importing structs from the root package in favor of defining an
interface for the functions which are called.

Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-06-26 18:20:23 -07:00
Derek McGowan
374fa24a53 Add multierror function to api network
Preserve error formatting without importing internal package from the
root package.

Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-06-26 18:07:14 -07:00
Derek McGowan
0964fa01ba Remove dependency on testutil from client
To separate the client into a separate module, it cannot depend on
testutil under the root module.

Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-06-26 15:33:40 -07:00
Derek McGowan
58404b0c28 Remove dependency on httputil for client hijack test
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-06-26 14:16:39 -07:00
Sebastiaan van Stijn
a6be38a4e2 Merge pull request #50269 from crazy-max/fix-winres
cmd: fix winresources and move them out cli package
2025-06-26 20:20:57 +02:00
Sebastiaan van Stijn
00408909c5 Merge pull request #50262 from mmorel-35/revive-0
fix: easiest revive rules
2025-06-26 17:04:44 +02:00
CrazyMax
e7289e7e02 hack: check windows resources are set in the binary
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
2025-06-26 17:03:32 +02:00
Kevin Alvarez
44623fb856 cmd: use dockerfile to generate win event messages
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
2025-06-26 17:03:32 +02:00
Kevin Alvarez
0ea20c9f72 cmd: fix winresources and move them out cli package
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
2025-06-26 15:56:23 +02:00
Matthieu MOREL
6b8afec95b fix redefines-builtin-id from revive
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2025-06-26 12:07:45 +00:00
Matthieu MOREL
90ab64cbda fix increment-decrement from revive
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2025-06-26 12:07:38 +00:00
Matthieu MOREL
381d9d0723 fix use-errors-new from revive
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2025-06-26 12:07:38 +00:00
Matthieu MOREL
f0136d1dba fix superfluous-else from revive
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2025-06-26 12:07:38 +00:00
Matthieu MOREL
369c8f828e fix var-declaration from revive
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2025-06-26 12:07:24 +00:00
Paweł Gronowski
ee49437e38 Merge pull request #50010 from dmcgowan/dockerd-command-daemon
Split dockerd main command to package under daemon
2025-06-26 10:19:06 +00:00
Sebastiaan van Stijn
1daa58a4ca Merge pull request #50267 from vvoland/gha-tags-fixcomment
gha/bin-image: update tags comment
2025-06-25 20:31:37 +02:00
Paweł Gronowski
d72f219a11 gha/bin-image: update tags comment
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-06-25 16:50:44 +02:00
Sebastiaan van Stijn
85aa504a8f Merge pull request #50263 from vvoland/gha-tags
gha/bin-image: add major and minor version image tags
2025-06-25 14:47:27 +02:00
Sebastiaan van Stijn
82ca3ccaf3 Merge pull request #50265 from austinvazquez/update-maintainer-info
Update maintainer info for austinvazquez
2025-06-25 08:19:12 +02:00
Matthieu MOREL
b40fe5cb8b pluginrpc-gen: align generator with generated
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2025-06-25 07:51:37 +02:00
Austin Vazquez
f8fcc20c3b Update maintainer info for austinvazquez
Signed-off-by: Austin Vazquez <austin.vazquez.dev@gmail.com>
2025-06-24 15:09:37 -07:00
Paweł Gronowski
38b98bcf68 gha/bin-image: add major and minor version image tags
Adding image tags that follow the semver major and minor versions (e.g., `28`
and `28.3`) for the moby-bin images.

This makes it easier for users to reference the latest build within a
major or minor version series without having to know the exact
minor/patch version.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-06-24 23:30:58 +02:00
Cory Snider
057e35dd65 libnetwork/d/overlay: ref-count encryption params
The IPsec encryption parameters (Security Association Database and
Security Policy Database entries) for a particular overlay network peer
(VTEP) are shared global state as they have to be programmed into the
root network namespace. The same parameters are used when encrypting
VXLAN traffic to a particular VTEP for all overlay networks. Deleting
the entries for a VTEP will break encryption to that VTEP across all
encrypted overlay networks, therefore the decision of when to delete the
entries must take the state of all overlay networks into account.
Unfortunately this is not the case.

The overlay driver uses local per-network state to decide when to
program and delete the parameters for a VTEP. In practice, the
parameters for all VTEPs participating in an encrypted overlay network
are deleted when the network is deleted. Encryption to that VTEP over
all other active encrypted overlay networks would be broken until some
other incidental peerDB event triggered a re-programming of the
parameters for that VTEP.

Change the setupEncryption and removeEncryption functions to be
reference-counted. The removeEncryption function needs to be called the
same number of times as addEncryption before the parameters are deleted
from the kernel.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2025-06-24 13:30:13 -04:00
Cory Snider
1c2b744ca2 libnetwork/d/overlay: properly model peer db
The overlay driver assumes that the peer table in NetworkDB will always
converge to a 1:1:1 mapping from peer endpoint IP address to MAC address
to VTEP. While this currently holds true in practice most of the time,
it is not an invariant and there are ways that users can violate this
assumption.

The driver detects whether peer entries conflict with each other by
matching up (IP, MAC) tuples. In the common case this works out fine as
the MAC address for an endpoint is generally derived from the assigned
IP address. If an IP address gets reassigned to a container on another
node the MAC address will follow, so the driver's conflict resolution
logic will behave as intended. However users may explicitly configure
the MAC address for a container's network endpoints. If an IP address
gets reassigned from a container with an auto-generated MAC address to a
container with a manually-configured MAC, or vice versa, the driver
would not detect the conflict as the (IP, MAC) tuples won't match up. It
would attempt to program the kernel's neighbor table with two
conflicting MAC addresses for one IP, which will fail. And since it
does not realize that there is a conflict, the driver won't reprogram
the kernel from the remaining entry when the other entry is deleted.

The assumption that only one IP address may resolve to a given MAC
address is violated if multiple IP addresses are assigned to an
endpoint. This rarely comes up in practice today as the overlay driver
only supports IPv4 single-stack connectivity for endpoints. If multiple
distinct peer entries exist with the same MAC address, the driver will
delete the MAC->VTEP mapping from the kernel's forwarding database when
any entry is deleted, even if other entries remain active. This
limitation is one of the biggest obstacles in the way of supporting IPv6
and dual-stack connectivity for endpoints attached to overlay networks.

Modify the peer db logic to correctly handle the cases where peer
entries have non-unique MAC or VTEP values. Treat any set of entries
with non-unique IP addresses as a conflict, irrespective of the entries'
MAC addresses. Maintain a reference count of forwarding database entries
and only delete the MAC->VTEP mapping from the kernel when there are no
longer any neighbor entries which resolve to that MAC.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2025-06-24 13:30:11 -04:00
Cory Snider
59437f56f9 libnetwork/d/overlay: refactor peer db impl
The peer db implementation is more complex than it needs to be.
Notably, the peerCRUD / peerCRUDOp function split is a vestige of its
evolution from a worker goroutine receiving commands over a channel.

Refactor the peer db operations to be easier to read, understand and
modify. Factor the kernel-programming operations out into dedicated
addNeighbor and deleteNeighbor functions. Inline the rest of the
peerCRUDOp functions into their respective peerCRUD wrappers.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2025-06-24 13:28:26 -04:00
Sebastiaan van Stijn
ed1406cb93 Merge pull request #50236 from corhere/libn/overlay-really-delete-neigh
libn/d/overlay: delete FDB entry from AF_BRIDGE
2025-06-24 18:13:54 +02:00
Sebastiaan van Stijn
4bcb850902 Merge pull request #50257 from thaJeztah/TestCreateByImageID_minor_nits
integration/container: TestCreateByImageID: minor improvements
2025-06-24 13:14:40 +02:00
Derek McGowan
33139da522 Split part of dockerd main to command under daemon
Allows using daemon/internal packages when creating dockerd

Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-06-23 14:45:03 -07:00
Derek McGowan
98047c5190 Move cmd/dockerd/trap to daemon/command/trap
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-06-23 14:45:03 -07:00
Derek McGowan
ea11b5f3fe Move cmd/dockerd/debug to daemon/command/debug
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-06-23 14:45:02 -07:00
Albin Kerouanton
a41225dcfd Merge pull request #50091 from corhere/libn/overlay-refactor-checkencryption
libnetwork/d/overlay: simplify the encryption logic
2025-06-23 21:32:02 +02:00
Sebastiaan van Stijn
6edb15c5fc Merge pull request #50255 from crazy-max/update-govulncheck
dockerfile: update govulncheck to v1.1.4
2025-06-23 13:04:31 +02:00
Sebastiaan van Stijn
53475e1adf integration/container: TestCreateByImageID: minor improvements
- Assert that we're not using empty IDs
- stringid.TruncateID already truncates algorithm, so we can just feed
  it the full id
- Fail early on error, and skip asserting the `resp.ID` to reduce some
  noise;

    === FAIL: github.com/docker/docker/integration/container TestCreateByImageID/image_short-ID (60.33s)
        create_test.go:134: assertion failed: resp.ID is ""
        create_test.go:135: assertion failed: error is not nil: error during connect: Post "http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.48/containers/create": EOF

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-06-23 12:19:44 +02:00
CrazyMax
fcf666f9b0 dockerfile: update govulncheck to v1.1.4
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
2025-06-23 10:02:38 +02:00
Paweł Gronowski
4ac341638f Merge pull request #50246 from thaJeztah/simplify_headers
client: Client.addHeaders: remove special handling for api < 1.25
2025-06-20 18:39:39 +00:00
Paweł Gronowski
f8bd49525b Merge pull request #50224 from thaJeztah/faster_trim
daemon: LogContainerEventWithAttributes: minor optimisation
2025-06-20 16:31:32 +00:00
Paweł Gronowski
8d39ec90ac Merge pull request #50245 from vvoland/cut-api
docs: cut api docs for v1.51
2025-06-20 16:17:05 +00:00
Sebastiaan van Stijn
8c067c5223 client: Client.addHeaders: remove special handling for api < 1.25
Commit e98e4a7111 introduced functionality
to hide experimental commands, and hide commands based on API version
negotiation. Before that commit, the user-agent header was used to detect
version-mismatches between the daemon and client based on their binary
version;
3975d648b7/api/server/middleware/user_agent.go (L32-L44)

Because of the above, a check was added to prevent custom headers from
modifying the User-Agent, but given that the user-agent header changed
formatting, and api < 1.25 is long deprecated, it's not very meaningful
to add this check, so let's remove it.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-06-20 18:10:04 +02:00
Paweł Gronowski
ef50844a0b docs: cut api docs for v1.51
Used by the upcoming 28.3.0 release

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-06-20 18:00:53 +02:00
Paweł Gronowski
dc14a75b24 Merge pull request #50177 from thaJeztah/tweak_timeouts
gha: lower timeouts on "build" and "merge" steps
2025-06-20 14:28:21 +00:00
Sebastiaan van Stijn
6025adfbef Merge pull request #50226 from robmry/driver_api_optional_extconn
libnet: split ProgramExternalConnectivity/RevokeExternalConnectivity out of driverapi
2025-06-20 13:31:18 +02:00
Sebastiaan van Stijn
381699364e Merge pull request #50238 from crazy-max/buildkit-0.23.1
vendor: update buildkit to v0.23.1
2025-06-20 13:23:17 +02:00
Sebastiaan van Stijn
9a465b6ab1 Merge pull request #50231 from thaJeztah/update_cgroups
vendor: github.com/opencontainers/cgroups v0.0.3
2025-06-20 13:00:12 +02:00
Sebastiaan van Stijn
775f50e821 Merge pull request #50233 from thaJeztah/validate_mirrors
daemon/config: Validate: add missing validation for registry mirrors and improve errors
2025-06-20 12:50:48 +02:00
Sebastiaan van Stijn
a0f36cc926 Merge pull request #50220 from thaJeztah/fix_event_ordering
daemon: containerStop: fix ordering of "stop" and "die" events
2025-06-20 12:44:17 +02:00
CrazyMax
5a02e7f4e3 vendor: update buildkit to v0.23.1
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
2025-06-20 11:38:08 +02:00
Paweł Gronowski
e124ab621c Merge pull request #50237 from dmcgowan/update-containerd-2.1.3
Update containerd to v2.1.3
2025-06-20 09:27:26 +00:00
Derek McGowan
b466c35da1 Update containerd to v2.1.3
Fixes various issues with pulling from registries

Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-06-19 15:57:03 -07:00
Cory Snider
7a12bbe5d3 libn/d/overlay: delete FDB entry from AF_BRIDGE
Starting with commit 0d6e7cd983
DeleteNeighbor() needs to be called with the same options as the
AddNeighbor() call that created the neighbor entry. The calls in peerdb
were modified incorrectly, resulting in the deletes failing and leaking
neighbor entries. Fix up the DeleteNeighbor calls so that the FDB entry
is deleted from the FDB instead of the neighbor table, and the neighbor
is deleted from the neighbor table instead of the FDB.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2025-06-19 17:24:16 -04:00
Sebastiaan van Stijn
1d8545d60c daemon/config: Validate: add missing validation for registry mirrors
Validation of registry mirrors was performed during daemon startup,
but after the config-file was validated. As a result, the `--validate`
option would incorrectly print that the configuration was valid, but
the daemon would fail to start;

    echo '{"registry-mirrors":["example.com"]}' > my-config.json
    dockerd --config-file ./my-config.json --validate
    configuration OK

    dockerd --config-file ./my-config.json
    # ...
    failed to start daemon: invalid mirror: no scheme specified for "example.com": must use either 'https://' or 'http://'

With this patch applied, validation is also performed as part of the
daemon config validation;

    echo '{"registry-mirrors":["example.com"]}' > my-config.json
    dockerd --config-file ./my-config.json --validate
    unable to configure the Docker daemon with file ./my-config.json: merged configuration validation from file and command line flags failed: invalid mirror: no scheme specified for "example.com": must use either 'https://' or 'http://'

    # fix the invalid config
    echo '{"registry-mirrors":["https://example.com"]}' > my-config.json
    dockerd --config-file ./my-config.json --validate
    configuration OK

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-06-19 14:22:11 +02:00
Sebastiaan van Stijn
307c18598d registry: ValidateMirror: improve validation for missing schemes
Before this patch, a missing scheme would sometimes produce a confusing
error message. If no scheme was specified at all, an empty "" would be
included in the message;

    echo '{"registry-mirrors":["example.com"]}' > my-config.json
    dockerd --config-file ./my-config.json
    # ...
    failed to start daemon: invalid mirror: unsupported scheme "" in "example.com"

If a scheme was missing, but a port was included, the hostname would be
printed as the scheme;

    echo '{"registry-mirrors":["example.com:8080"]}' > my-config.json
    dockerd --config-file ./my-config.json
    # ...
    failed to start daemon: invalid mirror: unsupported scheme "example.com" in "example.com:8080"

With this patch applied, the error messages are slightly more user-friendly;

    echo '{"registry-mirrors":["example.com"]}' > my-config.json
    dockerd --config-file ./my-config.json
    # ...
    failed to start daemon: invalid mirror: no scheme specified for "example.com": must use either 'https://' or 'http://'

    echo '{"registry-mirrors":["example.com:8080"]}' > my-config.json
    dockerd --config-file ./my-config.json
    # ...
    failed to start daemon: invalid mirror: no scheme specified for "example.com:8080": must use either 'https://' or 'http://'

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-06-19 14:21:58 +02:00
Sebastiaan van Stijn
a90da2edc3 vendor: github.com/opencontainers/cgroups v0.0.3
- ConvertCPUSharesToCgroupV2Value: improve
- Add .github/dependabot.yml
- Remove annotations from Resources (fixes a regression introduced in v0.0.2)

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-06-19 12:38:04 +02:00
Akihiro Suda
bd965df6ae Merge pull request #50207 from thaJeztah/bump_alpine
gha: dco: bump alpine to 3.22
2025-06-19 18:26:10 +09:00
Sebastiaan van Stijn
bb858f3b27 Merge pull request #50229 from corhere/libn/fix-networkdb-dns-update-delete
libnetwork: fix flaky Swarm service DNS
2025-06-19 10:29:43 +02:00
Cory Snider
a7f01d238e libnetwork: fix flaky Swarm service DNS
When libnetwork receives a watch event for a driver table entry from
NetworkDB it passes the event along to the interested driver. This code
contains a subtle bug: update events from NetworkDB are passed along to
the driver as Delete events! This bug was lying dormant as driver-table
entries can only be added by the driver, not updated. Now that NetworkDB
broadcasts an UpdateEvent to watchers if the entry is already known to
the local NetworkDB, irrespective of whether the event received from the
remote peer was a CREATE or UPDATE event, the bug is causing problems.
Whenever a remote node replaces an entry in the overlay_peer_table but
the intermediate delete state was not received by the local node, the
new CREATE event would be translated to an UpdateEvent by NetworkDB and
subsequently handled by the overlay driver as if the entry was deleted!

Bubble table UPDATE events up to the network driver as Update events.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2025-06-18 17:58:08 -04:00
Sebastiaan van Stijn
062082ec9b daemon: containerStop: fix ordering of "stop" and "die" events
Commit 8e6cd44ce4 added synchronisation to
wait for the container's status to be updated in memory. However, since
952902efbc, a defer was used to produce
the container's "stop" event.

As a result of the sychronisation that was added, the "die" event would
now be produced before the "stop" event.

This patch moves the locking inside the defer to restore the previous
behavior.

Unfortunately the order of events is still not guaranteed, because events
are emited from multiple goroutines that don't have synchronisation between
them; this is something to look at for follow ups. This patch keeps the status
quo and should preserve the old behavior, which was "more" correct in most
cases.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-06-18 20:42:52 +02:00
Cory Snider
de24c536b0 Merge pull request #50193 from corhere/libn/networkdb-fix-crudtable-flakes-harder
libnetwork/networkdb: prioritize local table broadcasts over event rebroadcasts
2025-06-18 13:34:57 -04:00
Rob Murray
bf002e51a0 Split [Program|Revoke]ExternalConnectivity out of libnet driverapi
Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-06-18 17:38:35 +01:00
Rob Murray
4ccbca1efe Add TestRoutedNonGateway
Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-06-18 17:21:57 +01:00
Sebastiaan van Stijn
0c56619d79 Merge pull request #50218 from thaJeztah/deprecate_execconfig_detach
api/types/container: deprecate ExecOptions.Detach
2025-06-18 17:52:39 +02:00
Sebastiaan van Stijn
d85513e1a3 daemon: LogContainerEventWithAttributes: minor optimisation
As we're only expecting a single `/` prefix to be trimmed from the
container name, it's better to use `TrimPrefix` than `TrimLeft`, as
`TrimPrefix` takes a cut-set to remove any character in the set.

Benchmarking both;

    BenchmarkTrimLeft-10      535364544    2.204  ns/op    0 B/op    0 allocs/op
    BenchmarkTrimPrefix-10   1000000000    0.3148 ns/op    0 B/op    0 allocs/op

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-06-18 13:14:43 +02:00
Sebastiaan van Stijn
d31f67f4ea Merge pull request #50209 from thaJeztah/pkg_idtools_deprecate
pkg/idtools: deprecate IdentityMapping, Identity.Chown
2025-06-18 12:23:35 +02:00
Rob Murray
b387526fce Merge pull request #49981 from robmry/drop_inc_rules
Drop DOCKER-ISOLATION rules
2025-06-17 20:22:00 +01:00
Sebastiaan van Stijn
b0d6155e7c Merge pull request #50180 from robmry/test_nftabler
Add TestNftabler
2025-06-17 21:11:30 +02:00
Sebastiaan van Stijn
5b9fa6c07a Merge pull request #50222 from jsternberg/buildkit-update
vendor: github.com/moby/buildkit v0.23.0
2025-06-17 20:36:11 +02:00
Rob Murray
ec185e57cf Test Nftabler params
Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-06-17 18:28:20 +01:00
Jonathan A. Sternberg
e43968d7ed vendor: github.com/moby/buildkit v0.23.0
Signed-off-by: Jonathan A. Sternberg <jonathan.sternberg@docker.com>
2025-06-17 12:17:47 -05:00
Sebastiaan van Stijn
0c182d4d57 api/types/container: deprecate ExecOptions.Detach
This field was added in 5130fe5d38, which
added it for use as intermediate struct when parsing CLI flags (through
`runconfig.ParseExec`) in c786a8ee5e.

Commit 9d9dff3d0d rewrote the CLI to use
Cobra, and as part of this introduced a separate `execOptions` type in
`api/client/container`.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-06-17 12:38:33 +02:00
Paweł Gronowski
9b4f68d64c Merge pull request #50214 from tonistiigi/update-buildkit-v0.23.0-rc2
vendor: update buildkit to v0.13.0-rc2
2025-06-17 09:57:55 +00:00
Paweł Gronowski
a9c0420463 Merge pull request #50119 from PowerPixel/50118-add-stdcopy-containerexecattach
docs(client/ContainerExecAttach): add a mention to stdcopy.StdCopy
2025-06-17 09:39:19 +00:00
Sebastiaan van Stijn
dde7a4c22f Merge pull request #50212 from corhere/vendor-tagged-swarmkit-v2
vendor: github.com/moby/swarmkit/v2 v2.0.0
2025-06-17 11:22:51 +02:00
Rob Murray
126f99d776 Add a way to undo nftables.Enable(), for unit tests
Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-06-17 09:52:48 +01:00
Rob Murray
30aa9a891d Merge pull request #50104 from robmry/outline_nftabler
nftables: add initial/outline nftabler
2025-06-17 09:52:00 +01:00
Tonis Tiigi
1289519b03 vendor: update buildkit to v0.13.0-rc2
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2025-06-16 18:13:02 -07:00
Cory Snider
c3ac979ecf vendor: github.com/moby/swarmkit/v2 v2.0.0
Use the tagged version instead of the v2.0.0-20250613170222-a45be3cac15c
pseudo-version. The referenced commit has not changed.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2025-06-16 12:54:12 -04:00
Medhy DOHOU
4891396da6 docs(client/ContainerExecAttach): add a mention to stdcopy.StdCopy
Add a mention to stdcopy.StdCopy to the documentation, as the stream returned in the HijackedResponse is multiplexed when tty is disabled.

Signed-off-by: Medhy DOHOU <52136144+PowerPixel@users.noreply.github.com>
2025-06-16 16:53:02 +00:00
Sebastiaan van Stijn
cab4ac834e Merge pull request #50202 from corhere/fix-swarmkit-3200
vendor: github.com/moby/swarmkit/v2 v2.0.0-20250613170222-a45be3cac15c
2025-06-16 17:48:11 +02:00
Sebastiaan van Stijn
b7ef527bdc pkg/idtools: deprecate IdentityMapping, Identity.Chown
The IdentityMapping and Identity types are still used internally, but
should be considered transitional.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-06-16 17:38:40 +02:00
Sebastiaan van Stijn
66e9cd97f2 remove deprecated pkg/archive, pkg/chrootarchive
These packages were deprecated in 57a042b77c
(v28.1.0), and moved to a separate module.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-06-16 16:41:06 +02:00
Sebastiaan van Stijn
d06c22f27d remove deprecated pkg/reexec
This package was deprecated in 4f5ec9994c
(v28.0.0), and moved to a separate module.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-06-16 16:30:40 +02:00
Sebastiaan van Stijn
98015c21ec remove deprecated pkg/atomicwriter
The atomicwriter utilities were moved to a separate package in commit
7864454792 (v28.0.0), which in its turn was
moved to a separate module in 6422ff2804
(v28.1.0).

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-06-16 16:28:40 +02:00
Sebastiaan van Stijn
cf91441a1b pkg/ioutils: remove deprecated atomicwriter functions
The atomicwriter utilities were moved to a separate package in commit
7864454792 (v28.0.0), which in its turn was
moved to a separate module in 6422ff2804
(v28.1.0).

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-06-16 16:27:54 +02:00
Sebastiaan van Stijn
1f0e9077e4 remove deprecated pkg/parsers
- `ParseKeyValueOpt` was deprecated in 5b18a7914c
  and moved to the graphdriver package.
- `ParseUintListMaximum` and `ParseUintList` were deprecated in commit
  064cdf475c after they were moved internal
  to pkg/sysinfo in 2282279180.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-06-16 16:21:22 +02:00
Rob Murray
c66abe486b nftabler: add mirrored WSL2 loopback0 workaround
Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-06-16 15:19:47 +01:00
Rob Murray
d31956b2f7 Add an outline nftabler
Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-06-16 15:19:45 +01:00
Sebastiaan van Stijn
04618dfc0b remove deprecated pkg/platform
This package was deprecated in b034dc41a2,
which moved it internal. That commit was part of v28.0.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-06-16 16:14:38 +02:00
Sebastiaan van Stijn
f1e93a1770 pkg/system: remove deprecated MkdirAll
This was deprecated in 4472e9b7f8, which
was part of docker v28.0.0, and to be removed in the next major
release.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-06-16 16:10:47 +02:00
Sebastiaan van Stijn
ce31bf3f0b gha: dco: bump alpine to 3.22
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-06-16 16:03:17 +02:00
Rob Murray
1ad9599da7 Drop DOCKER-ISOLATION rules
The Inter-Network Communication rules in the iptables chains
DOCKER-ISOLATION-STAGE-1 / DOCKER-ISOLATION-STAGE-2 (which are
called from filter-FORWARD) currently:
- Block access from containers in one bridge network, to ports
  published to host addresses by containers in other bridge
  networks, when the userland-proxy is disabled.
  - But, that access is allowed when the proxy is enabled.
- Block access to all ports on container addresses in gateway
  mode "nat-unprotected" networks.
  - But, those ports can be accessed from anywhere else, including
    other hosts. Just not other bridge networks.
- Allow access from containers in "nat" bridge networks to published
  ports on container addresses in "routed" networks. But, to do that,
  extra INC rules are added for the routed network.

The INC rules are no longer needed to block access from containers
in one network to unpublished ports on container addresses in
other networks. Direct routing to containers in NAT networks is
blocked by the "raw-PREROUTING" rules that block access from
untrusted interfaces (all interfaces apart from the network's
own bridge).

Drop these INC rules to resolve the inconsistencies listed above,
with this change:
- Published ports on host addresses can be accessed from containers
  in other networks (even without the userland-proxy).
- The rules for direct routing between bridge networks are the same
  as the rules for direct routing from outside the Docker host
  (allowed for gw modes "routed" and "nat-unprotected", disallowed
  for "nat").

Fewer rules, so it's simpler, and perhaps slightly faster.

Internal networks (with no access to networks outside the host)
are also implemented using rules in the DOCKER-ISOLATION chains.
This change moves those rules to a new chain, DOCKER-INTERNAL,
and drops the DOCKER-ISOLATION chains.

Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-06-16 14:54:31 +01:00
Cory Snider
2d60b8eacd vendor: github.com/moby/swarmkit/v2 v2.0.0-20250613170222-a45be3cac15c
- fix task scheduler infinite loop

full diff: 8c19597365...a45be3cac1

Signed-off-by: Cory Snider <csnider@mirantis.com>
2025-06-13 17:44:53 -04:00
Cory Snider
6ec6e0991a libnetwork/networkdb: prioritize local broadcasts
A network node is responsible for both broadcasting table events for
entries it owns and for rebroadcasting table events from other nodes it
has received. Table events to be broadcast are added to a single queue
per network, including events for rebroadcasting. As the memberlist
TransmitLimitedQueue is (to a first approximation) LIFO, a flood of
events from other nodes could delay the broadcasting of
locally-generated events indefinitely. Prioritize broadcasting local
events by splitting up the queues and only pulling from the rebroadcast
queue if there is free space in the gossip packet after draining the
local-broadcast queue.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2025-06-13 17:08:18 -04:00
Cory Snider
e9a7154909 libnetwork/networkdb: improve TestCRUDTableEntries
Log more details when assertions fail to provide a more complete picture
of what went wrong when TestCRUDTableEntries fails. Log the state of
each NetworkDB instance at various points in TestCRUDTableEntries to
provide an even more complete picture.

Increase the global logger verbosity in tests so warnings and debug logs
are printed to the test log.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2025-06-13 17:08:17 -04:00
Cory Snider
dbb0d88109 libn/networkdb: use distinct type for own networks
NetworkDB uses a muli-dimensional map of struct network to keep track of
network attachments for both remote nodes and the local node. Only a
subset of the struct fields are used for remote nodes' network
attachments. The tableBroadcasts pointer field in particular is
always initialized for network values representing local attachments
(read: nDB.networks[nDB.config.NodeID]) and always nil for remote
attachments. Consequently, unnecessary defensive nil-pointer checks are
peppered throughout the code despite the aforementioned invariant.

Enshrine the invariant that tableBroadcasts is initialized iff the
network attachment is for the local node in the type system. Pare down
struct network to only the fields needed for remote network attachments
and move the local-only fields into a new struct thisNodeNetwork. Elide
the unnecessary nil-checks.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2025-06-13 17:08:11 -04:00
Cory Snider
51f31826ee libnetwork/networkdb: don't clear queue on rejoin
When joining a network that was previously joined but not yet reaped,
NetworkDB replaces the network struct value with a zeroed-out one with
the entries count copied over. This is also the case when joining a
network that is currently joined! Consequently, joining a network has
the side effect of clearing the broadcast queue. If the queue is cleared
while messages are still pending broadcast, convergence may be delayed
until the next bulk sync cycle.

Make it an error to join a network twice without leaving. Retain the
existing broadcast queue when rejoining a network that has not yet been
reaped.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2025-06-13 17:08:09 -04:00
Cory Snider
30b27ab6ea libnetwork/networkdb: drop id field from network
The map key for nDB.networks is the network ID. The struct field is not
actually used anywhere in practice.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2025-06-13 16:25:19 -04:00
Sebastiaan van Stijn
9316396db0 gha: run windows 2025 on PRs, 2022 scheduled
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-06-12 21:19:03 +02:00
Sebastiaan van Stijn
6f484d0d4c gha: update to windows 2022 / 2025
The hosted Windows 2019 runners reach EOL on June 30;
https://github.com/actions/runner-images/issues/12045

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-06-12 21:19:00 +02:00
Sebastiaan van Stijn
0a30b98447 gha: lower timeouts on "build" and "merge" steps
We had some runs timeout after 120 minutes; expected duration is much
lower than that, so let's lower the timeout to make actions fail faster.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-06-12 10:21:43 +02:00
Sebastiaan van Stijn
accbfde61e client: use go-winio.DialPipe directly
The go-connections package implementation is only a shallow wrapper
around go-winio for named pipes; use the go-winio implementation
directly.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-06-02 14:38:47 +02:00
Cory Snider
df6b405796 libnetwork/d/overlay: drop initEncryption function
The (*driver).Join function does many things to set up overlay
networking. One of the first things it does is call
(*network).joinSandbox, which in turn calls (*driver).initSandboxPeerDB.
The initSandboxPeerDB function iterates through the peer db to add
entries to the VXLAN FDB, neighbor table and IPsec security association
database in the kernel for all known peers on the overlay network.

One of the last things the (*driver).Join function does is call
(*driver).initEncryption. The initEncryption function iterates through
the peer db to add entries to the IPsec security association database in
the kernel for all known peers on the overlay network. But the preceding
initSandboxPeerDB call already did that! The initEncryption function is
redundant and can safely be removed.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2025-05-29 14:13:13 -04:00
Cory Snider
713f887698 libnetwork/d/overlay: drop checkEncryption function
In addition to being three functions in a trenchcoat, the
checkEncryption function has a very subtle implementation which is
difficult to reason about. That is not a good property for security
relevant code to have.

Replace two of the three calls to checkEncryption with conditional calls
to setupEncryption and removeEncryption, lifting the conditional logic
which was hidden away in checkEncryption into the call sites to make it
easier to reason about the code. Replace the third call with a call to a
new initEncryption function.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2025-05-29 14:13:13 -04:00
Cory Snider
cb4e7b2f03 libnetwork/d/overlay: make setupEncryption a method
The setupEncryption and removeEncryption functions take several
parameters, but all call sites pass the same values for all the
parameters aside from remoteIP: values taken from fields of the driver
struct. Refactor these functions to be methods of the driver struct and
drop the redundant parameters.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2025-05-29 14:13:13 -04:00
Cory Snider
0d893252ac libnetwork/d/overlay: checkEncryption: drop isLocal param
Since it is not meaningful to add or remove encryption between the local
node and itself, the isLocal parameter is redundant. Setting up
encryption for all network peers is now invoked by calling

    checkEncryption(nid, netip.Addr{}, true)

Calling checkEncryption with isLocal=true, add=false is now more
explicitly a no-op. It always was effectively a no-op, but that was not
easy to spot by inspection. In the world with the isLocal flag,
calls to checkEncryption where isLocal=true and add=false would have rIP
set to d.advertiseAddr. In other words, it was a request to remove
encryption parameters between the local peer and itself if peerDB had no
remote-peer entries for the network. So either the call would do
nothing, or it would remove encryption parameters that aren't used for
anything. Now the equivalent call always does nothing.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2025-05-29 14:13:13 -04:00
Cory Snider
4b1c1236b9 libnetwork/d/overlay: peerdb: drop isLocal param
Drop the isLocal boolean parameters from the peerDB functions. Local
peers have vtep == netip.Addr{}.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2025-05-29 14:13:13 -04:00
Cory Snider
48e0b24ff7 libnetwork/d/overlay: elide vtep for local peers
The VTEP value for a peer in peerDB is only accurate for a remote peer.
The VTEP for a local peer would be the driver's advertise address, which
is not necessarily constant for the lifetime of the driver instance.
The VTEP values persisted in the peerDB entries for local peers could be
stale or missing if not kept in sync with the advertise address. And the
peerDB could get polluted with duplicate entries for local peers if the
advertise address was to change, as entries which differ only by VTEP
are considered distinct by SetMatrix. Persisting the advertise address
as the VTEP for local peers creates lots of problems that are not easy
to solve.

Stop persisting the VTEP for local peers in peerDB. Any code that needs
to know the VTEP for local peers can look that up from the source of
truth: the driver's advertise address. Use the lack of a VTEP in peerDB
entries to signify local peers, making the isLocal flag redundant.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2025-05-29 14:13:13 -04:00
Cory Snider
a9e2d6d06e libnetwork/d/overlay: filter local peers explicitly
The overlay driver's checkEncryption function configures the IPSec
parameters for the VXLAN tunnels to peer nodes. When called with
isLocal=true, it configures encryption for all peer nodes with at least
one peerDB entry. Since the local peers are also included in the peerDB,
it needs to filter those entries out. It does so by filtering out any
peer entries whose VTEP address is equal to the current local advertise
address. Trouble is, the local advertise address is not necessarily
constant. The driver tries to handle this case by calling
peerDBUpdateSelf() when the advertise address changes. This function
iterates through the peerDB and tries to update the VTEP address for all
local peer entries, but it does not actually do anything: it mutates a
temporary copy of the entry which is not persisted back into the peerDB.
(It used to be functional, but was broken when the peerDB was extended
to use SetMatrix.) So there may be cases where local peer entries are
not filtered out properly, resulting in spurious encryption parameters
being programmed into the kernel.

Filter out local peers when walking the peerDB by filtering on whether
the entry has the isLocal flag set. Remove the no-op code which attempts
to update local entries in the peerDB. No other code takes any interest
in the VTEP value for isLocal peer entries.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2025-05-29 14:13:13 -04:00
3234 changed files with 118340 additions and 36135 deletions

View File

@@ -2,5 +2,5 @@
# build artifacts
/bundles/
/cli/winresources/dockerd/winres.json
/cli/winresources/dockerd/*.syso
/cmd/dockerd/winresources/winres.json
/cmd/dockerd/*.syso

2
.gitattributes vendored
View File

@@ -1,3 +1 @@
Dockerfile* linguist-language=Dockerfile
vendor.mod linguist-language=Go-Module
vendor.sum linguist-language=Go-Checksums

View File

@@ -16,7 +16,7 @@ on:
workflow_call:
env:
ALPINE_VERSION: "3.21"
ALPINE_VERSION: "3.22"
jobs:
run:

View File

@@ -1,45 +0,0 @@
# reusable workflow
name: .test-prepare
# TODO: hide reusable workflow from the UI. Tracked in https://github.com/community/community/discussions/12025
# Default to 'contents: read', which grants actions to read commits.
#
# If any permission is set, any permission not included in the list is
# implicitly set to "none".
#
# see https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#permissions
permissions:
contents: read
on:
workflow_call:
outputs:
matrix:
description: Test matrix
value: ${{ jobs.run.outputs.matrix }}
jobs:
run:
runs-on: ubuntu-24.04
timeout-minutes: 120 # guardrails timeout for the whole job
outputs:
matrix: ${{ steps.set.outputs.matrix }}
steps:
-
name: Checkout
uses: actions/checkout@v4
-
name: Create matrix
id: set
uses: actions/github-script@v7
with:
script: |
let matrix = ['graphdriver'];
if ("${{ contains(github.event.pull_request.labels.*.name, 'containerd-integration') || github.event_name != 'pull_request' }}" == "true") {
matrix.push('snapshotter');
}
await core.group(`Set matrix`, async () => {
core.info(`matrix: ${JSON.stringify(matrix)}`);
core.setOutput('matrix', JSON.stringify(matrix));
});

View File

@@ -16,7 +16,7 @@ on:
workflow_call:
env:
GO_VERSION: "1.24.4"
GO_VERSION: "1.24.6"
GOTESTLIST_VERSION: v0.3.1
TESTSTAT_VERSION: v0.1.25
SETUP_BUILDX_VERSION: edge

View File

@@ -21,13 +21,13 @@ on:
default: "graphdriver"
env:
GO_VERSION: "1.24.4"
GO_VERSION: "1.24.6"
GOTESTLIST_VERSION: v0.3.1
TESTSTAT_VERSION: v0.1.25
ITG_CLI_MATRIX_SIZE: 6
DOCKER_EXPERIMENTAL: 1
DOCKER_GRAPHDRIVER: ${{ inputs.storage == 'snapshotter' && 'overlayfs' || 'overlay2' }}
TEST_INTEGRATION_USE_SNAPSHOTTER: ${{ inputs.storage == 'snapshotter' && '1' || '' }}
TEST_INTEGRATION_USE_GRAPHDRIVER: ${{ inputs.storage == 'graphdriver' && '1' || '' }}
SETUP_BUILDX_VERSION: edge
SETUP_BUILDKIT_IMAGE: moby/buildkit:latest
@@ -144,7 +144,9 @@ jobs:
// { os: 'ubuntu-24.04', mode: 'rootless-systemd' }, // FIXME: https://github.com/moby/moby/issues/44084
];
if ("${{ inputs.storage }}" == "snapshotter") {
includes.push({ os: 'ubuntu-24.04', mode: 'firewalld' });
includes.push({ os: 'ubuntu-24.04', mode: 'iptables+firewalld' });
includes.push({ os: 'ubuntu-24.04', mode: 'nftables' });
includes.push({ os: 'ubuntu-24.04', mode: 'nftables+firewalld' });
}
await core.group(`Set matrix`, async () => {
core.info(`matrix: ${JSON.stringify(includes)}`);
@@ -190,6 +192,9 @@ jobs:
echo "FIREWALLD=true" >> $GITHUB_ENV
CACHE_DEV_SCOPE="${CACHE_DEV_SCOPE}firewalld"
fi
if [[ "${{ matrix.mode }}" == *"nftables"* ]]; then
echo "DOCKER_FIREWALL_BACKEND=nftables" >> $GITHUB_ENV
fi
echo "CACHE_DEV_SCOPE=${CACHE_DEV_SCOPE}" >> $GITHUB_ENV
-
name: Set up Docker Buildx
@@ -328,19 +333,43 @@ jobs:
// 'include' with other matrix variables that aren't part of the
// include items.
// Moreover, since the goal is to run only relevant tests with
// firewalld enabled to minimize the number of CI jobs, we
// firewalld/nftables enabled to minimize the number of CI jobs, we
// statically define the list of test suites that we want to run.
if ("${{ inputs.storage }}" == "snapshotter") {
matrix.include.push({
'mode': 'firewalld',
'mode': 'iptables+firewalld',
'test': 'DockerCLINetworkSuite|DockerCLIPortSuite|DockerDaemonSuite'
});
matrix.include.push({
'mode': 'firewalld',
'mode': 'iptables+firewalld',
'test': 'DockerSwarmSuite'
});
matrix.include.push({
'mode': 'firewalld',
'mode': 'iptables+firewalld',
'test': 'DockerNetworkSuite'
});
matrix.include.push({
'mode': 'nftables',
'test': 'DockerCLINetworkSuite|DockerCLIPortSuite|DockerDaemonSuite'
});
matrix.include.push({
'mode': 'nftables',
'test': 'DockerSwarmSuite'
});
matrix.include.push({
'mode': 'nftables',
'test': 'DockerNetworkSuite'
});
matrix.include.push({
'mode': 'nftables+firewalld',
'test': 'DockerCLINetworkSuite|DockerCLIPortSuite|DockerDaemonSuite'
});
matrix.include.push({
'mode': 'nftables+firewalld',
'test': 'DockerSwarmSuite'
});
matrix.include.push({
'mode': 'nftables+firewalld',
'test': 'DockerNetworkSuite'
});
}
@@ -380,6 +409,9 @@ jobs:
echo "FIREWALLD=true" >> $GITHUB_ENV
CACHE_DEV_SCOPE="${CACHE_DEV_SCOPE}firewalld"
fi
if [[ "${{ matrix.mode }}" == *"nftables"* ]]; then
echo "DOCKER_FIREWALL_BACKEND=nftables" >> $GITHUB_ENV
fi
echo "CACHE_DEV_SCOPE=${CACHE_DEV_SCOPE}" >> $GITHUB_ENV
-
name: Set up Docker Buildx
@@ -437,7 +469,7 @@ jobs:
if: always()
uses: actions/upload-artifact@v4
with:
name: test-reports-integration-cli-${{ inputs.storage }}-${{ env.TESTREPORTS_NAME }}
name: test-reports-integration-cli-${{ inputs.storage }}-${{ matrix.mode }}-${{ env.TESTREPORTS_NAME }}
path: /tmp/reports/*
retention-days: 1
@@ -460,7 +492,7 @@ jobs:
uses: actions/download-artifact@v4
with:
path: /tmp/reports
pattern: test-reports-integration-cli-${{ inputs.storage }}-*
pattern: test-reports-integration-cli-${{ inputs.storage }}-${{ matrix.mode }}-*
merge-multiple: true
-
name: Install teststat

View File

@@ -28,12 +28,12 @@ on:
default: false
env:
GO_VERSION: "1.24.4"
GO_VERSION: "1.24.6"
GOTESTLIST_VERSION: v0.3.1
TESTSTAT_VERSION: v0.1.25
WINDOWS_BASE_IMAGE: mcr.microsoft.com/windows/servercore
WINDOWS_BASE_TAG_2019: ltsc2019
WINDOWS_BASE_TAG_2022: ltsc2022
WINDOWS_BASE_TAG_2025: ltsc2025
TEST_IMAGE_NAME: moby:test
TEST_CTN_NAME: moby
DOCKER_BUILDKIT: 0
@@ -65,8 +65,8 @@ jobs:
run: |
New-Item -ItemType "directory" -Path "${{ github.workspace }}\go-build"
New-Item -ItemType "directory" -Path "${{ github.workspace }}\go\pkg\mod"
If ("${{ inputs.os }}" -eq "windows-2019") {
echo "WINDOWS_BASE_IMAGE_TAG=${{ env.WINDOWS_BASE_TAG_2019 }}" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append
If ("${{ inputs.os }}" -eq "windows-2025") {
echo "WINDOWS_BASE_IMAGE_TAG=${{ env.WINDOWS_BASE_TAG_2025 }}" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append
} ElseIf ("${{ inputs.os }}" -eq "windows-2022") {
echo "WINDOWS_BASE_IMAGE_TAG=${{ env.WINDOWS_BASE_TAG_2022 }}" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append
}
@@ -92,7 +92,6 @@ jobs:
& docker build `
--build-arg WINDOWS_BASE_IMAGE `
--build-arg WINDOWS_BASE_IMAGE_TAG `
--build-arg GO_VERSION `
-t ${{ env.TEST_IMAGE_NAME }} `
-f Dockerfile.windows .
-
@@ -145,8 +144,8 @@ jobs:
New-Item -ItemType "directory" -Path "${{ github.workspace }}\go-build"
New-Item -ItemType "directory" -Path "${{ github.workspace }}\go\pkg\mod"
New-Item -ItemType "directory" -Path "bundles"
If ("${{ inputs.os }}" -eq "windows-2019") {
echo "WINDOWS_BASE_IMAGE_TAG=${{ env.WINDOWS_BASE_TAG_2019 }}" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append
If ("${{ inputs.os }}" -eq "windows-2025") {
echo "WINDOWS_BASE_IMAGE_TAG=${{ env.WINDOWS_BASE_TAG_2025 }}" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append
} ElseIf ("${{ inputs.os }}" -eq "windows-2022") {
echo "WINDOWS_BASE_IMAGE_TAG=${{ env.WINDOWS_BASE_TAG_2022 }}" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append
}
@@ -172,7 +171,6 @@ jobs:
& docker build `
--build-arg WINDOWS_BASE_IMAGE `
--build-arg WINDOWS_BASE_IMAGE_TAG `
--build-arg GO_VERSION `
-t ${{ env.TEST_IMAGE_NAME }} `
-f Dockerfile.windows .
-
@@ -321,8 +319,8 @@ jobs:
name: Init
run: |
New-Item -ItemType "directory" -Path "bundles"
If ("${{ inputs.os }}" -eq "windows-2019") {
echo "WINDOWS_BASE_IMAGE_TAG=${{ env.WINDOWS_BASE_TAG_2019 }}" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append
If ("${{ inputs.os }}" -eq "windows-2025") {
echo "WINDOWS_BASE_IMAGE_TAG=${{ env.WINDOWS_BASE_TAG_2025 }}" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append
} ElseIf ("${{ inputs.os }}" -eq "windows-2022") {
echo "WINDOWS_BASE_IMAGE_TAG=${{ env.WINDOWS_BASE_TAG_2022 }}" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append
}
@@ -366,10 +364,10 @@ jobs:
"--exec-root=$env:TEMP\moby-exec", `
"--pidfile=$env:TEMP\docker.pid", `
"--register-service"
If ("${{ inputs.storage }}" -eq "snapshotter") {
If ("${{ inputs.storage }}" -eq "graphdriver") {
# Make the env-var visible to the service-managed dockerd, as there's no CLI flag for this option.
& reg add "HKLM\SYSTEM\CurrentControlSet\Services\docker" /v Environment /t REG_MULTI_SZ /s '@' /d TEST_INTEGRATION_USE_SNAPSHOTTER=1
echo "TEST_INTEGRATION_USE_SNAPSHOTTER=1" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append
& reg add "HKLM\SYSTEM\CurrentControlSet\Services\docker" /v Environment /t REG_MULTI_SZ /s '@' /d TEST_INTEGRATION_USE_GRAPHDRIVER=1
echo "TEST_INTEGRATION_USE_GRAPHDRIVER=1" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append
}
Write-Host "Starting service"
Start-Service -Name docker
@@ -441,7 +439,6 @@ jobs:
.\hack\make.ps1 -TestIntegration
env:
DOCKER_HOST: npipe:////./pipe/docker_engine
GO111MODULE: "off"
TEST_CLIENT_BINARY: ${{ env.BIN_OUT }}\docker
-
name: Test integration-cli
@@ -450,7 +447,6 @@ jobs:
.\hack\make.ps1 -TestIntegrationCli
env:
DOCKER_HOST: npipe:////./pipe/docker_engine
GO111MODULE: "off"
TEST_CLIENT_BINARY: ${{ env.BIN_OUT }}\docker
INTEGRATION_TESTRUN: ${{ matrix.test }}
-

View File

@@ -23,7 +23,7 @@ on:
pull_request:
env:
GO_VERSION: "1.24.4"
GO_VERSION: "1.24.6"
TESTSTAT_VERSION: v0.1.25
DESTDIR: ./build
SETUP_BUILDX_VERSION: edge

View File

@@ -58,17 +58,21 @@ jobs:
### versioning strategy
## push semver tag v23.0.0
# moby/moby-bin:23.0.0
# moby/moby-bin:23.0
# moby/moby-bin:23
# moby/moby-bin:latest
## push semver prerelease tag v23.0.0-beta.1
# moby/moby-bin:23.0.0-beta.1
## push on master
# moby/moby-bin:master
## push on 23.0 branch
# moby/moby-bin:23.0
## push on 28.x branch
# moby/moby-bin:28.x
tags: |
type=semver,pattern={{version}}
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{major}}
type=semver,pattern={{major}}.{{minor}}
-
name: Rename meta bake definition file
# see https://github.com/docker/metadata-action/issues/381#issuecomment-1918607161
@@ -91,7 +95,7 @@ jobs:
build:
runs-on: ubuntu-24.04
timeout-minutes: 120 # guardrails timeout for the whole job
timeout-minutes: 20 # guardrails timeout for the whole job
needs:
- validate-dco
- prepare
@@ -167,7 +171,7 @@ jobs:
merge:
runs-on: ubuntu-24.04
timeout-minutes: 120 # guardrails timeout for the whole job
timeout-minutes: 40 # guardrails timeout for the whole job
needs:
- build
if: always() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') && github.event_name != 'pull_request' && github.repository == 'moby/moby'

View File

@@ -23,7 +23,7 @@ on:
pull_request:
env:
GO_VERSION: "1.24.4"
GO_VERSION: "1.24.6"
DESTDIR: ./build
SETUP_BUILDX_VERSION: edge
SETUP_BUILDKIT_IMAGE: moby/buildkit:latest
@@ -220,7 +220,6 @@ jobs:
& docker build `
--build-arg WINDOWS_BASE_IMAGE `
--build-arg WINDOWS_BASE_IMAGE_TAG `
--build-arg GO_VERSION `
-t ${{ env.TEST_IMAGE_NAME }} `
-f Dockerfile.windows .

View File

@@ -46,19 +46,10 @@ jobs:
uses: actions/checkout@v4
with:
fetch-depth: 2
# CodeQL 2.16.4's auto-build added support for multi-module repositories,
# and is trying to be smart by searching for modules in every directory,
# including vendor directories. If no module is found, it's creating one
# which is ... not what we want, so let's give it a "go.mod".
# see: https://github.com/docker/cli/pull/4944#issuecomment-2002034698
- name: Create go.mod
run: |
ln -s vendor.mod go.mod
ln -s vendor.sum go.sum
- name: Update Go
uses: actions/setup-go@v5
with:
go-version: "1.24.4"
go-version: "1.24.6"
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:

View File

@@ -23,7 +23,7 @@ on:
pull_request:
env:
GO_VERSION: "1.24.4"
GO_VERSION: "1.24.6"
GIT_PAGER: "cat"
PAGER: "cat"
SETUP_BUILDX_VERSION: edge

View File

@@ -14,15 +14,20 @@ on:
types: [opened, edited, labeled, unlabeled, synchronize]
jobs:
check-area-label:
check-labels:
runs-on: ubuntu-24.04
timeout-minutes: 120 # guardrails timeout for the whole job
steps:
- name: Missing `area/` label
if: contains(join(github.event.pull_request.labels.*.name, ','), 'impact/') && !contains(join(github.event.pull_request.labels.*.name, ','), 'area/')
if: always() && contains(join(github.event.pull_request.labels.*.name, ','), 'impact/') && !contains(join(github.event.pull_request.labels.*.name, ','), 'area/')
run: |
echo "::error::Every PR with an 'impact/*' label should also have an 'area/*' label"
exit 1
- name: Missing `kind/` label
if: always() && contains(join(github.event.pull_request.labels.*.name, ','), 'impact/') && !contains(join(github.event.pull_request.labels.*.name, ','), 'kind/')
run: |
echo "::error::Every PR with an 'impact/*' label should also have a 'kind/*' label"
exit 1
- name: OK
run: exit 0

View File

@@ -14,32 +14,23 @@ concurrency:
cancel-in-progress: true
on:
schedule:
- cron: '0 10 * * *'
workflow_dispatch:
push:
branches:
- 'master'
- '[0-9]+.[0-9]+'
- '[0-9]+.x'
pull_request:
jobs:
validate-dco:
uses: ./.github/workflows/.dco.yml
test-prepare:
uses: ./.github/workflows/.test-prepare.yml
needs:
- validate-dco
run:
needs:
- test-prepare
uses: ./.github/workflows/.windows.yml
secrets: inherit
strategy:
fail-fast: false
matrix:
storage: ${{ fromJson(needs.test-prepare.outputs.matrix) }}
storage:
- graphdriver
- snapshotter
with:
os: windows-2022
storage: ${{ matrix.storage }}

View File

@@ -1,4 +1,4 @@
name: windows-2019
name: windows-2025
# Default to 'contents: read', which grants actions to read commits.
#
@@ -14,29 +14,28 @@ concurrency:
cancel-in-progress: true
on:
schedule:
- cron: '0 10 * * *'
workflow_dispatch:
push:
branches:
- 'master'
- '[0-9]+.[0-9]+'
- '[0-9]+.x'
pull_request:
jobs:
validate-dco:
uses: ./.github/workflows/.dco.yml
test-prepare:
uses: ./.github/workflows/.test-prepare.yml
needs:
- validate-dco
run:
needs:
- test-prepare
uses: ./.github/workflows/.windows.yml
secrets: inherit
strategy:
fail-fast: false
matrix:
storage: ${{ fromJson(needs.test-prepare.outputs.matrix) }}
storage:
- graphdriver
- snapshotter
with:
os: windows-2019
os: windows-2025
storage: ${{ matrix.storage }}
send_coverage: false

4
.gitignore vendored
View File

@@ -15,8 +15,8 @@ thumbs.db
# build artifacts
/bundles/
/cli/winresources/dockerd/*.syso
/cli/winresources/dockerd/winres.json
/cmd/dockerd/winresources/winres.json
/cmd/dockerd/*.syso
# ci artifacts
*.exe

View File

@@ -3,7 +3,7 @@ version: "2"
run:
# prevent golangci-lint from deducting the go version to lint for through go.mod,
# which causes it to fallback to go1.17 semantics.
go: "1.24.4"
go: "1.24.6"
concurrency: 2
# Only supported with go modules enabled (build flag -mod=vendor only valid when using modules)
# modules-download-mode: vendor
@@ -69,6 +69,8 @@ linters:
desc: Use github.com/moby/sys/userns instead.
- pkg: "github.com/tonistiigi/fsutil"
desc: The fsutil module does not have a stable API, so we should not have a direct dependency unless necessary.
- pkg: "github.com/hashicorp/go-multierror"
desc: "Use errors.Join instead"
dupword:
ignore:
@@ -103,11 +105,11 @@ linters:
msg: Go 1.19 atomic types should be used instead.
- pkg: ^regexp$
pattern: ^regexp\.MustCompile
msg: Use internal/lazyregexp.New instead.
msg: Use daemon/internal/lazyregexp.New instead.
- pkg: github.com/vishvananda/netlink$
pattern: ^netlink\.(Handle\.)?(AddrList|BridgeVlanList|ChainList|ClassList|ConntrackTableList|ConntrackDeleteFilter$|ConntrackDeleteFilters|DevLinkGetDeviceList|DevLinkGetAllPortList|DevlinkGetDeviceParams|FilterList|FouList|GenlFamilyList|GTPPDPList|LinkByName|LinkByAlias|LinkList|LinkSubscribeWithOptions|NeighList$|NeighProxyList|NeighListExecute|NeighSubscribeWithOptions|LinkGetProtinfo|QdiscList|RdmaLinkList|RdmaLinkByName|RdmaLinkDel|RouteList|RouteListFilteredIter|RuleListFiltered$|RouteSubscribeWithOptions|RuleList$|RuleListFiltered|SocketGet|SocketDiagTCPInfo|SocketDiagTCP|SocketDiagUDPInfo|SocketDiagUDP|UnixSocketDiagInfo|UnixSocketDiag|VDPAGetDevConfigList|VDPAGetDevList|VDPAGetMGMTDevList|XfrmPolicyList|XfrmStateList)
msg: Use internal nlwrap package for EINTR handling.
- pkg: github.com/docker/docker/internal/nlwrap$
- pkg: github.com/moby/moby/v2/internal/nlwrap$
pattern: ^nlwrap.Handle.(BridgeVlanList|ChainList|ClassList|ConntrackDeleteFilter$|DevLinkGetDeviceList|DevLinkGetAllPortList|DevlinkGetDeviceParams|FilterList|FouList|GenlFamilyList|GTPPDPList|LinkByAlias|LinkSubscribeWithOptions|NeighList$|NeighProxyList|NeighListExecute|NeighSubscribeWithOptions|LinkGetProtinfo|QdiscList|RdmaLinkList|RdmaLinkByName|RdmaLinkDel|RouteListFilteredIter|RuleListFiltered$|RouteSubscribeWithOptions|RuleList$|RuleListFiltered|SocketGet|SocketDiagTCPInfo|SocketDiagTCP|SocketDiagUDPInfo|SocketDiagUDP|UnixSocketDiagInfo|UnixSocketDiag|VDPAGetDevConfigList|VDPAGetDevList|VDPAGetMGMTDevList)
msg: Add a wrapper to nlwrap.Handle for EINTR handling and update the list in .golangci.yml.
analyze-types: true
@@ -204,10 +206,20 @@ linters:
max-func-lines: 0
revive:
# Only listed rules are applied
# https://github.com/mgechev/revive/blob/HEAD/RULES_DESCRIPTIONS.md
rules:
- name: increment-decrement
# FIXME make sure all packages have a description. Currently, there's many packages without.
- name: package-comments
disabled: true
- name: redefines-builtin-id
- name: superfluous-else
arguments:
- preserve-scope
- name: use-any
- name: use-errors-new
- name: var-declaration
staticcheck:
checks:
@@ -255,9 +267,6 @@ linters:
http-status-code: true
exclusions:
paths:
- volume/drivers/proxy.go # TODO: this is a generated file but with an invalid header, see https://github.com/moby/moby/pull/46274
rules:
# We prefer to use an "linters.exclusions.rules" so that new "default" exclusions are not
# automatically inherited. We can decide whether or not to follow upstream
@@ -303,11 +312,6 @@ linters:
linters:
- staticcheck
# FIXME(thaJeztah): ignoring these transitional utilities until BuildKit is vendored with https://github.com/moby/moby/pull/49743
- text: "SA1019: idtools\\.(ToUserIdentityMapping|FromUserIdentityMapping) is deprecated"
linters:
- staticcheck
# Ignore "nested context in function literal (fatcontext)" as we intentionally set up tracing on a base-context for tests.
# FIXME(thaJeztah): see if there's a more iodiomatic way to do this.
- text: 'nested context in function literal'
@@ -327,13 +331,21 @@ linters:
linters:
- forbidigo
- text: 'use of `regexp.MustCompile` forbidden'
path: "internal/lazyregexp"
path: "daemon/internal/lazyregexp"
linters:
- forbidigo
- text: 'use of `regexp.MustCompile` forbidden'
path: "internal/testutils"
linters:
- forbidigo
- text: 'use of `regexp.MustCompile` forbidden'
path: "libnetwork/cmd/networkdb-test/dbclient"
linters:
- forbidigo
- text: 'use of `regexp.MustCompile` forbidden'
path: "registry/"
linters:
- forbidigo
# Log a warning if an exclusion rule is unused.
# Default: false

View File

@@ -1,6 +1,6 @@
# syntax=docker/dockerfile:1
ARG GO_VERSION=1.24.4
ARG GO_VERSION=1.24.6
ARG BASE_DEBIAN_DISTRO="bookworm"
ARG GOLANG_IMAGE="golang:${GO_VERSION}-${BASE_DEBIAN_DISTRO}"
ARG XX_VERSION=1.6.1
@@ -10,7 +10,7 @@ ARG XX_VERSION=1.6.1
ARG VPNKIT_VERSION=0.6.0
# DOCKERCLI_VERSION is the version of the CLI to install in the dev-container.
ARG DOCKERCLI_VERSION=v28.2.2
ARG DOCKERCLI_VERSION=v28.3.2
ARG DOCKERCLI_REPOSITORY="https://github.com/docker/cli.git"
# cli version used for integration-cli tests
@@ -18,10 +18,10 @@ ARG DOCKERCLI_INTEGRATION_REPOSITORY="https://github.com/docker/cli.git"
ARG DOCKERCLI_INTEGRATION_VERSION=v18.06.3-ce
# BUILDX_VERSION is the version of buildx to install in the dev container.
ARG BUILDX_VERSION=0.24.0
ARG BUILDX_VERSION=0.25.0
# COMPOSE_VERSION is the version of compose to install in the dev container.
ARG COMPOSE_VERSION=v2.36.2
ARG COMPOSE_VERSION=v2.38.2
ARG SYSTEMD="false"
ARG FIREWALLD="false"
@@ -34,8 +34,8 @@ ARG DOCKER_STATIC=1
ARG REGISTRY_VERSION=3.0.0
# delve is currently only supported on linux/amd64 and linux/arm64;
# https://github.com/go-delve/delve/blob/v1.24.1/pkg/proc/native/support_sentinel.go#L1
# https://github.com/go-delve/delve/blob/v1.24.1/pkg/proc/native/support_sentinel_linux.go#L1
# https://github.com/go-delve/delve/blob/v1.25.0/pkg/proc/native/support_sentinel.go#L1
# https://github.com/go-delve/delve/blob/v1.25.0/pkg/proc/native/support_sentinel_linux.go#L1
#
# ppc64le support was added in v1.21.1, but is still experimental, and requires
# the "-tags exp.linuxppc64le" build-tag to be set:
@@ -64,7 +64,6 @@ COPY --from=xx / /
RUN go telemetry off && [ "$(go telemetry)" = "off" ] || { echo "Failed to disable Go telemetry"; exit 1; }
RUN echo 'Binary::apt::APT::Keep-Downloaded-Packages "true";' > /etc/apt/apt.conf.d/keep-cache
RUN apt-get update && apt-get install --no-install-recommends -y file
ENV GO111MODULE=off
ENV GOTOOLCHAIN=local
FROM base AS criu
@@ -82,25 +81,18 @@ FROM distribution/distribution:$REGISTRY_VERSION AS registry
RUN mkdir /build && mv /bin/registry /build/registry
# go-swagger
FROM base AS swagger-src
WORKDIR /usr/src/swagger
# Currently uses a fork from https://github.com/kolyshkin/go-swagger/tree/golang-1.13-fix
# TODO: move to under moby/ or fix upstream go-swagger to work for us.
RUN git init . && git remote add origin "https://github.com/kolyshkin/go-swagger.git"
# GO_SWAGGER_COMMIT specifies the version of the go-swagger binary to build and
# install. Go-swagger is used in CI for validating swagger.yaml in hack/validate/swagger-gen
ARG GO_SWAGGER_COMMIT=c56166c036004ba7a3a321e5951ba472b9ae298c
RUN git fetch -q --depth 1 origin "${GO_SWAGGER_COMMIT}" && git checkout -q FETCH_HEAD
FROM base AS swagger
WORKDIR /go/src/github.com/go-swagger/go-swagger
ARG TARGETPLATFORM
RUN --mount=from=swagger-src,src=/usr/src/swagger,rw \
--mount=type=cache,target=/root/.cache/go-build,id=swagger-build-$TARGETPLATFORM \
# GO_SWAGGER_VERSION specifies the version of the go-swagger binary to install.
# Go-swagger is used in CI for generating types from swagger.yaml in
# hack/validate/swagger-gen
ARG GO_SWAGGER_VERSION=v0.32.3
RUN --mount=type=cache,target=/root/.cache/go-build,id=swagger-build-$TARGETPLATFORM \
--mount=type=cache,target=/go/pkg/mod \
--mount=type=tmpfs,target=/go/src/ <<EOT
set -e
xx-go build -o /build/swagger ./cmd/swagger
GOBIN=/build xx-go install "github.com/go-swagger/go-swagger/cmd/swagger@${GO_SWAGGER_VERSION}"
xx-verify /build/swagger
EOT
@@ -135,7 +127,7 @@ RUN git init . && git remote add origin "https://github.com/go-delve/delve.git"
# from the https://github.com/go-delve/delve repository.
# It can be used to run Docker with a possibility of
# attaching debugger to it.
ARG DELVE_VERSION=v1.24.1
ARG DELVE_VERSION=v1.25.0
RUN git fetch -q --depth 1 origin "${DELVE_VERSION}" +refs/tags/*:refs/tags/* && git checkout -q FETCH_HEAD
FROM base AS delve-supported
@@ -145,7 +137,7 @@ RUN --mount=from=delve-src,src=/usr/src/delve,rw \
--mount=type=cache,target=/root/.cache/go-build,id=delve-build-$TARGETPLATFORM \
--mount=type=cache,target=/go/pkg/mod <<EOT
set -e
GO111MODULE=on xx-go build -o /build/dlv ./cmd/dlv
xx-go build -o /build/dlv ./cmd/dlv
xx-verify /build/dlv
EOT
@@ -157,7 +149,7 @@ FROM base AS gowinres
ARG GOWINRES_VERSION=v0.3.1
RUN --mount=type=cache,target=/root/.cache/go-build \
--mount=type=cache,target=/go/pkg/mod \
GOBIN=/build/ GO111MODULE=on go install "github.com/tc-hib/go-winres@${GOWINRES_VERSION}" \
GOBIN=/build/ go install "github.com/tc-hib/go-winres@${GOWINRES_VERSION}" \
&& /build/go-winres --help
# containerd
@@ -167,11 +159,8 @@ RUN git init . && git remote add origin "https://github.com/containerd/container
# CONTAINERD_VERSION is used to build containerd binaries, and used for the
# integration tests. The distributed docker .deb and .rpm packages depend on a
# separate (containerd.io) package, which may be a different version as is
# specified here. The containerd golang package is also pinned in vendor.mod.
# When updating the binary version you may also need to update the vendor
# version to pick up bug fixes or new APIs, however, usually the Go packages
# are built from a commit from the master branch.
ARG CONTAINERD_VERSION=v1.7.27
# specified here.
ARG CONTAINERD_VERSION=v1.7.28
RUN git fetch -q --depth 1 origin "${CONTAINERD_VERSION}" +refs/tags/*:refs/tags/* && git checkout -q FETCH_HEAD
FROM base AS containerd-build
@@ -205,27 +194,28 @@ FROM base AS golangci_lint
ARG GOLANGCI_LINT_VERSION=v2.1.5
RUN --mount=type=cache,target=/root/.cache/go-build \
--mount=type=cache,target=/go/pkg/mod \
GOBIN=/build/ GO111MODULE=on go install "github.com/golangci/golangci-lint/v2/cmd/golangci-lint@${GOLANGCI_LINT_VERSION}" \
GOBIN=/build/ go install "github.com/golangci/golangci-lint/v2/cmd/golangci-lint@${GOLANGCI_LINT_VERSION}" \
&& /build/golangci-lint --version
FROM base AS gotestsum
ARG GOTESTSUM_VERSION=v1.12.0
# GOTESTSUM_VERSION is the version of gotest.tools/gotestsum to install.
ARG GOTESTSUM_VERSION=v1.12.3
RUN --mount=type=cache,target=/root/.cache/go-build \
--mount=type=cache,target=/go/pkg/mod \
GOBIN=/build/ GO111MODULE=on go install "gotest.tools/gotestsum@${GOTESTSUM_VERSION}" \
GOBIN=/build/ go install "gotest.tools/gotestsum@${GOTESTSUM_VERSION}" \
&& /build/gotestsum --version
FROM base AS shfmt
ARG SHFMT_VERSION=v3.8.0
RUN --mount=type=cache,target=/root/.cache/go-build \
--mount=type=cache,target=/go/pkg/mod \
GOBIN=/build/ GO111MODULE=on go install "mvdan.cc/sh/v3/cmd/shfmt@${SHFMT_VERSION}" \
GOBIN=/build/ go install "mvdan.cc/sh/v3/cmd/shfmt@${SHFMT_VERSION}" \
&& /build/shfmt --version
FROM base AS gopls
RUN --mount=type=cache,target=/root/.cache/go-build \
--mount=type=cache,target=/go/pkg/mod \
GOBIN=/build/ GO111MODULE=on go install "golang.org/x/tools/gopls@latest" \
GOBIN=/build/ go install "golang.org/x/tools/gopls@latest" \
&& /build/gopls version
FROM base AS dockercli
@@ -259,9 +249,8 @@ WORKDIR /usr/src/runc
RUN git init . && git remote add origin "https://github.com/opencontainers/runc.git"
# RUNC_VERSION should match the version that is used by the containerd version
# that is used. If you need to update runc, open a pull request in the containerd
# project first, and update both after that is merged. When updating RUNC_VERSION,
# consider updating runc in vendor.mod accordingly.
ARG RUNC_VERSION=v1.2.6
# project first, and update both after that is merged.
ARG RUNC_VERSION=v1.3.0
RUN git fetch -q --depth 1 origin "${RUNC_VERSION}" +refs/tags/*:refs/tags/* && git checkout -q FETCH_HEAD
FROM base AS runc-build
@@ -328,7 +317,7 @@ FROM tini-${TARGETOS} AS tini
FROM base AS rootlesskit-src
WORKDIR /usr/src/rootlesskit
RUN git init . && git remote add origin "https://github.com/rootless-containers/rootlesskit.git"
# When updating, also update vendor.mod and hack/dockerfile/install/rootlesskit.installer accordingly.
# When updating, also update go.mod and hack/dockerfile/install/rootlesskit.installer accordingly.
ARG ROOTLESSKIT_VERSION=v2.3.4
RUN git fetch -q --depth 1 origin "${ROOTLESSKIT_VERSION}" +refs/tags/*:refs/tags/* && git checkout -q FETCH_HEAD
@@ -341,7 +330,6 @@ RUN --mount=type=cache,sharing=locked,id=moby-rootlesskit-aptlib,target=/var/lib
gcc \
libc6-dev \
pkg-config
ENV GO111MODULE=on
ARG DOCKER_STATIC
RUN --mount=from=rootlesskit-src,src=/usr/src/rootlesskit,rw \
--mount=type=cache,target=/go/pkg/mod \
@@ -542,14 +530,14 @@ COPY --link --from=dockercli-integration /build/ /usr/local/cli-integration
FROM base AS build
COPY --from=gowinres /build/ /usr/local/bin/
WORKDIR /go/src/github.com/docker/docker
ENV GO111MODULE=off
ENV CGO_ENABLED=1
RUN --mount=type=cache,sharing=locked,id=moby-build-aptlib,target=/var/lib/apt \
--mount=type=cache,sharing=locked,id=moby-build-aptcache,target=/var/cache/apt \
apt-get update && apt-get install --no-install-recommends -y \
clang \
lld \
llvm
llvm \
icoutils
ARG TARGETPLATFORM
RUN --mount=type=cache,sharing=locked,id=moby-build-aptlib,target=/var/lib/apt \
--mount=type=cache,sharing=locked,id=moby-build-aptcache,target=/var/cache/apt \
@@ -579,7 +567,6 @@ RUN <<EOT
fi
EOT
RUN --mount=type=bind,target=.,rw \
--mount=type=tmpfs,target=cli/winresources/dockerd \
--mount=type=cache,target=/root/.cache/go-build,id=moby-build-$TARGETPLATFORM <<EOT
set -e
target=$([ "$DOCKER_STATIC" = "1" ] && echo "binary" || echo "dynbinary")

View File

@@ -5,18 +5,17 @@
# This represents the bare minimum required to build and test Docker.
ARG GO_VERSION=1.24.4
ARG GO_VERSION=1.24.6
ARG BASE_DEBIAN_DISTRO="bookworm"
ARG GOLANG_IMAGE="golang:${GO_VERSION}-${BASE_DEBIAN_DISTRO}"
FROM ${GOLANG_IMAGE}
ENV GO111MODULE=off
ENV GOTOOLCHAIN=local
# Compile and runtime deps
# https://github.com/docker/docker/blob/master/project/PACKAGERS.md#build-dependencies
# https://github.com/docker/docker/blob/master/project/PACKAGERS.md#runtime-dependencies
# https://github.com/moby/moby/blob/master/project/PACKAGERS.md#build-dependencies
# https://github.com/moby/moby/blob/master/project/PACKAGERS.md#runtime-dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
curl \

View File

@@ -161,12 +161,14 @@ FROM ${WINDOWS_BASE_IMAGE}:${WINDOWS_BASE_IMAGE_TAG}
# Use PowerShell as the default shell
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
ARG GO_VERSION=1.24.4
ARG GOTESTSUM_VERSION=v1.12.0
ARG GO_VERSION=1.24.6
# GOTESTSUM_VERSION is the version of gotest.tools/gotestsum to install.
ARG GOTESTSUM_VERSION=v1.12.3
# GOWINRES_VERSION is the version of go-winres to install.
ARG GOWINRES_VERSION=v0.3.3
ARG CONTAINERD_VERSION=v1.7.27
ARG CONTAINERD_VERSION=v1.7.28
# Environment variable notes:
# - GO_VERSION must be consistent with 'Dockerfile' used by Linux.
@@ -176,7 +178,6 @@ ENV GO_VERSION=${GO_VERSION} `
CONTAINERD_VERSION=${CONTAINERD_VERSION} `
GIT_VERSION=2.11.1 `
GOPATH=C:\gopath `
GO111MODULE=off `
GOTOOLCHAIN=local `
FROM_DOCKERFILE=1 `
GOTESTSUM_VERSION=${GOTESTSUM_VERSION} `
@@ -276,13 +277,11 @@ RUN `
RUN `
Function Install-GoTestSum() { `
$Env:GO111MODULE = 'on'; `
$tmpGobin = "${Env:GOBIN_TMP}"; `
$Env:GOBIN = """${Env:GOPATH}`\bin"""; `
Write-Host "INFO: Installing gotestsum version $Env:GOTESTSUM_VERSION in $Env:GOBIN"; `
&go install "gotest.tools/gotestsum@${Env:GOTESTSUM_VERSION}"; `
$Env:GOBIN = "${tmpGobin}"; `
$Env:GO111MODULE = 'off'; `
if ($LASTEXITCODE -ne 0) { `
Throw '"gotestsum install failed..."'; `
} `
@@ -292,13 +291,11 @@ RUN `
RUN `
Function Install-GoWinres() { `
$Env:GO111MODULE = 'on'; `
$tmpGobin = "${Env:GOBIN_TMP}"; `
$Env:GOBIN = """${Env:GOPATH}`\bin"""; `
Write-Host "INFO: Installing go-winres version $Env:GOWINRES_VERSION in $Env:GOBIN"; `
&go install "github.com/tc-hib/go-winres@${Env:GOWINRES_VERSION}"; `
$Env:GOBIN = "${tmpGobin}"; `
$Env:GO111MODULE = 'off'; `
if ($LASTEXITCODE -ne 0) { `
Throw '"go-winres install failed..."'; `
} `

View File

@@ -6,7 +6,7 @@
# GitHub ID, Name, Email address, GPG fingerprint
"akerouanton","Albin Kerouanton","albinker@gmail.com"
"AkihiroSuda","Akihiro Suda","akihiro.suda.cz@hco.ntt.co.jp"
"austinvazquez","Austin Vazquez","macedonv@amazon.com"
"austinvazquez","Austin Vazquez","austin.vazquez.dev@gmail.com"
"corhere","Cory Snider","csnider@mirantis.com"
"cpuguy83","Brian Goff","cpuguy83@gmail.com"
"robmry","Rob Murray","rob.murray@docker.com"

View File

@@ -38,6 +38,7 @@ DOCKER_ENVS := \
-e DOCKERCLI_INTEGRATION_REPOSITORY \
-e DOCKER_DEBUG \
-e DOCKER_EXPERIMENTAL \
-e DOCKER_FIREWALL_BACKEND \
-e DOCKER_GITCOMMIT \
-e DOCKER_GRAPHDRIVER \
-e DOCKER_LDFLAGS \
@@ -53,7 +54,7 @@ DOCKER_ENVS := \
-e GITHUB_ACTIONS \
-e TEST_FORCE_VALIDATE \
-e TEST_INTEGRATION_DIR \
-e TEST_INTEGRATION_USE_SNAPSHOTTER \
-e TEST_INTEGRATION_USE_GRAPHDRIVER \
-e TEST_INTEGRATION_FAIL_FAST \
-e TEST_SKIP_INTEGRATION \
-e TEST_SKIP_INTEGRATION_CLI \

View File

@@ -1,9 +1,11 @@
The Moby Project
================
[![PkgGoDev](https://pkg.go.dev/badge/github.com/docker/docker)](https://pkg.go.dev/github.com/docker/docker)
[![Go Report Card](https://goreportcard.com/badge/github.com/docker/docker)](https://goreportcard.com/report/github.com/docker/docker)
[![PkgGoDev](https://pkg.go.dev/badge/github.com/moby/moby/v2)](https://pkg.go.dev/github.com/moby/moby/v2)
![GitHub License](https://img.shields.io/github/license/moby/moby)
[![Go Report Card](https://goreportcard.com/badge/github.com/moby/moby/v2)](https://goreportcard.com/report/github.com/moby/moby/v2)
[![OpenSSF Scorecard](https://api.scorecard.dev/projects/github.com/moby/moby/badge)](https://scorecard.dev/viewer/?uri=github.com/moby/moby)
[![OpenSSF Best Practices](https://www.bestpractices.dev/projects/10989/badge)](https://www.bestpractices.dev/projects/10989)
![Moby Project logo](docs/static_files/moby-project-logo.png "The Moby Project")

View File

@@ -113,5 +113,5 @@ We see gRPC as the natural communication layer between decoupled components.
In addition to pushing out large components into other projects, much of the
internal code structure, and in particular the
["Daemon"](https://godoc.org/github.com/docker/docker/daemon#Daemon) object,
["Daemon"](https://pkg.go.dev/github.com/moby/moby/v2/daemon#Daemon) object,
should be split into smaller, more manageable, and more testable components.

View File

@@ -8,11 +8,11 @@ questions you may have as an aspiring Moby contributor.
Moby has two test suites (and one legacy test suite):
* Unit tests - use standard `go test` and
[gotest.tools/assert](https://godoc.org/gotest.tools/assert) assertions. They are located in
[gotest.tools/v3/assert](https://pkg.go.dev/gotest.tools/v3/assert) assertions. They are located in
the package they test. Unit tests should be fast and test only their own
package.
* API integration tests - use standard `go test` and
[gotest.tools/assert](https://godoc.org/gotest.tools/assert) assertions. They are located in
[gotest.tools/v3/assert](https://pkg.go.dev/gotest.tools/v3/assert) assertions. They are located in
`./integration/<component>` directories, where `component` is: container,
image, volume, etc. These tests perform HTTP requests to an API endpoint and
check the HTTP response and daemon state after the call.
@@ -57,17 +57,28 @@ Instead, implement new tests under `integration/`.
### Integration tests environment considerations
When adding new tests or modifying existing tests under `integration/`, testing
environment should be properly considered. `skip.If` from
[gotest.tools/skip](https://godoc.org/gotest.tools/skip) can be used to make the
environment should be properly considered. [`skip.If`](https://pkg.go.dev/gotest.tools/v3/skip#If) from
[gotest.tools/v3/skip](https://pkg.go.dev/gotest.tools/v3/skip) can be used to make the
test run conditionally. Full testing environment conditions can be found at
[environment.go](https://github.com/moby/moby/blob/6b6eeed03b963a27085ea670f40cd5ff8a61f32e/testutil/environment/environment.go)
[environment.go](https://github.com/moby/moby/blob/311b2c87e125c6d4198014369e313135cf928a8a/testutil/environment/environment.go)
Here is a quick example. If the test needs to interact with a docker daemon on
the same host, the following condition should be checked within the test code
```go
skip.If(t, testEnv.IsRemoteDaemon())
// your integration test code
package example
import (
"testing"
"gotest.tools/v3/skip"
)
func TestSomething(t *testing.T) {
skip.If(t, testEnv.IsRemoteDaemon(), "test requires a local daemon")
// your integration test code
}
```
If a remote daemon is detected, the test will be skipped.
@@ -78,11 +89,11 @@ If a remote daemon is detected, the test will be skipped.
To run the unit test suite:
```
```bash
make test-unit
```
or `hack/test/unit` from inside a `BINDDIR=. make shell` container or properly
or `hack/test/unit` from inside a `make shell` container or properly
configured environment.
The following environment variables may be used to run a subset of tests:
@@ -95,7 +106,7 @@ The following environment variables may be used to run a subset of tests:
To run the integration test suite:
```
```bash
make test-integration
```
@@ -121,6 +132,6 @@ automatically set the other above mentioned environment variables accordingly.
You can change a version of golang used for building stuff that is being tested
by setting `GO_VERSION` variable, for example:
```
make GO_VERSION=1.12.8 test
```bash
make GO_VERSION=1.24.6 test
```

View File

@@ -1,46 +0,0 @@
# Vendoring policies
This document outlines recommended Vendoring policies for Docker repositories.
(Example, libnetwork is a Docker repo and logrus is not.)
## Vendoring using tags
Commit ID based vendoring provides little/no information about the updates
vendored. To fix this, vendors will now require that repositories use annotated
tags along with commit ids to snapshot commits. Annotated tags by themselves
are not sufficient, since the same tag can be force updated to reference
different commits.
Each tag should:
- Follow Semantic Versioning rules (refer to section on "Semantic Versioning")
- Have a corresponding entry in the change tracking document.
Each repo should:
- Have a change tracking document between tags/releases. Ex: CHANGELOG.md,
github releases file.
The goal here is for consuming repos to be able to use the tag version and
changelog updates to determine whether the vendoring will cause any breaking or
backward incompatible changes. This also means that repos can specify having
dependency on a package of a specific version or greater up to the next major
release, without encountering breaking changes.
## Semantic Versioning
Annotated version tags should follow [Semantic Versioning](http://semver.org) policies:
"Given a version number MAJOR.MINOR.PATCH, increment the:
1. MAJOR version when you make incompatible API changes,
2. MINOR version when you add functionality in a backwards-compatible manner, and
3. PATCH version when you make backwards-compatible bug fixes.
Additional labels for pre-release and build metadata are available as extensions
to the MAJOR.MINOR.PATCH format."
## Vendoring cadence
In order to avoid huge vendoring changes, it is recommended to have a regular
cadence for vendoring updates. e.g. monthly.
## Pre-merge vendoring tests
All related repos will be vendored into docker/docker.
CI on docker/docker should catch any breaking changes involving multiple repos.

View File

@@ -1,12 +1,18 @@
# Working on the Engine API
# Engine API
[![PkgGoDev](https://pkg.go.dev/badge/github.com/moby/moby/api)](https://pkg.go.dev/github.com/moby/moby/api)
![GitHub License](https://img.shields.io/github/license/moby/moby)
[![Go Report Card](https://goreportcard.com/badge/github.com/moby/moby/api)](https://goreportcard.com/report/github.com/moby/moby/api)
[![OpenSSF Scorecard](https://api.scorecard.dev/projects/github.com/moby/moby/badge)](https://scorecard.dev/viewer/?uri=github.com/moby/moby)
[![OpenSSF Best Practices](https://www.bestpractices.dev/projects/10989/badge)](https://www.bestpractices.dev/projects/10989)
The Engine API is an HTTP API used by the command-line client to communicate with the daemon. It can also be used by third-party software to control the daemon.
It consists of various components in this repository:
- `api/swagger.yaml` A Swagger definition of the API.
- `api/types/` Types shared by both the client and server, representing various objects, options, responses, etc. Most are written manually, but some are automatically generated from the Swagger definition. See [#27919](https://github.com/docker/docker/issues/27919) for progress on this.
- `cli/` The command-line client.
- `api/types/` Types shared by both the client and server, representing various objects, options, responses, etc. Most are written manually, but some are automatically generated from the Swagger definition. See [#27919](https://github.com/moby/moby/issues/27919) for progress on this.
- `client/` The Go client used by the command-line client. It can also be used by third-party Go programs.
- `daemon/` The daemon, which serves the API.
@@ -21,6 +27,7 @@ The API is defined by the [Swagger](http://swagger.io/specification/) definition
## Updating the API documentation
The API documentation is generated entirely from `api/swagger.yaml`. If you make updates to the API, edit this file to represent the change in the documentation.
Documentation for each API version can be found in the [docs directory](docs/README.md), which also provides a [CHANGELOG.md](docs/CHANGELOG.md).
The file is split into two main sections:
@@ -29,7 +36,7 @@ The file is split into two main sections:
To make an edit, first look for the endpoint you want to edit under `paths`, then make the required edits. Endpoints may reference reusable objects with `$ref`, which can be found in the `definitions` section.
There is hopefully enough example material in the file for you to copy a similar pattern from elsewhere in the file (e.g. adding new fields or endpoints), but for the full reference, see the [Swagger specification](https://github.com/docker/docker/issues/27919).
There is hopefully enough example material in the file for you to copy a similar pattern from elsewhere in the file (e.g. adding new fields or endpoints), but for the full reference, see the [Swagger specification](https://github.com/moby/moby/issues/27919).
`swagger.yaml` is validated by `hack/validate/swagger` to ensure it is a valid Swagger definition. This is useful when making edits to ensure you are doing the right thing.
@@ -39,4 +46,4 @@ When you make edits to `swagger.yaml`, you may want to check the generated API d
Run `make swagger-docs` and a preview will be running at `http://localhost:9000`. Some of the styling may be incorrect, but you'll be able to ensure that it is generating the correct documentation.
The production documentation is generated by vendoring `swagger.yaml` into [docker/docker.github.io](https://github.com/docker/docker.github.io).
The production documentation is generated by vendoring `swagger.yaml` into [docker/docs](https://github.com/docker/docs).

View File

@@ -3,18 +3,14 @@ package api
// Common constants for daemon and client.
const (
// DefaultVersion of the current REST API.
DefaultVersion = "1.51"
DefaultVersion = "1.52"
// MinSupportedAPIVersion is the minimum API version that can be supported
// by the API server, specified as "major.minor". Note that the daemon
// may be configured with a different minimum API version, as returned
// in [github.com/docker/docker/api/types.Version.MinAPIVersion].
// in [github.com/moby/moby/api/types.Version.MinAPIVersion].
//
// API requests for API versions lower than the configured version produce
// an error.
MinSupportedAPIVersion = "1.24"
// NoBaseImageSpecifier is the symbol used by the FROM
// command to specify that no base image is to be used.
NoBaseImageSpecifier = "scratch"
)

View File

@@ -13,6 +13,16 @@ keywords: "API, Docker, rcli, REST, documentation"
will be rejected.
-->
## v1.52 API changes
[Docker Engine API v1.52](https://docs.docker.com/reference/api/engine/version/v1.52/) documentation
* `GET /images/{name}/get` now accepts multiple `platform` query-arguments
to allow selecting which platform(s) of a multi-platform image must be
saved.
* `POST /images/load` now accepts multiple `platform` query-arguments
to allow selecting which platform(s) of a multi-platform image to load.
## v1.51 API changes
[Docker Engine API v1.51](https://docs.docker.com/reference/api/engine/version/v1.51/) documentation

26
api/docs/README.md Normal file
View File

@@ -0,0 +1,26 @@
# API Documentation
This directory contains versioned documents for each version of the API
specification supported by this module. While this module provides support
for older API versions, support should be considered "best-effort", especially
for very old versions. Users are recommended to use the latest API versions,
and only rely on older API versions for compatibility with older clients.
Newer API versions tend to be backward-compatible with older versions,
with some exceptions where features were deprecated. For an overview
of changes for each version, refer to [CHANGELOG.md](CHANGELOG.md).
The latest version of the API specification can be found [at the root directory
of this module](../swagger.yaml) which may contain unreleased changes.
For API version v1.24, documentation is only available in markdown
format, for later versions [Swagger (OpenAPI) v2.0](https://swagger.io/specification/v2/)
specifications can be found in this directory. The Moby project itself
primarily uses these swagger files to produce the API documentation;
while we attempt to make these files match the actual implementation,
the OpenAPI 2.0 specification has limitations that prevent us from
expressing all options provided. There may be discrepancies (for which
we welcome contributions). If you find bugs, or discrepancies, please
open a ticket (or pull request).

View File

@@ -1975,6 +1975,7 @@ definitions:
ForceUpdate:
description: "A counter that triggers an update even if no relevant parameters have been changed."
type: "integer"
format: "uint64"
Networks:
type: "array"
items:

View File

@@ -1979,6 +1979,7 @@ definitions:
ForceUpdate:
description: "A counter that triggers an update even if no relevant parameters have been changed."
type: "integer"
format: "uint64"
Networks:
type: "array"
items:

View File

@@ -2051,6 +2051,7 @@ definitions:
ForceUpdate:
description: "A counter that triggers an update even if no relevant parameters have been changed."
type: "integer"
format: "uint64"
Networks:
type: "array"
items:

View File

@@ -2104,6 +2104,7 @@ definitions:
ForceUpdate:
description: "A counter that triggers an update even if no relevant parameters have been changed."
type: "integer"
format: "uint64"
Networks:
type: "array"
items:

View File

@@ -2125,6 +2125,7 @@ definitions:
ForceUpdate:
description: "A counter that triggers an update even if no relevant parameters have been changed."
type: "integer"
format: "uint64"
Networks:
type: "array"
items:

View File

@@ -2303,6 +2303,7 @@ definitions:
ForceUpdate:
description: "A counter that triggers an update even if no relevant parameters have been changed."
type: "integer"
format: "uint64"
Runtime:
description: "Runtime is the type of runtime specified for the task executor."
type: "string"

View File

@@ -2332,6 +2332,7 @@ definitions:
ForceUpdate:
description: "A counter that triggers an update even if no relevant parameters have been changed."
type: "integer"
format: "uint64"
Runtime:
description: "Runtime is the type of runtime specified for the task executor."
type: "string"
@@ -2861,7 +2862,7 @@ definitions:
([RFC 4648](https://tools.ietf.org/html/rfc4648#section-5)) string.
It must be empty if the Driver field is set, in which case the data is
loaded from an external secret store. The maximum allowed size is 500KB,
as defined in [MaxSecretSize](https://pkg.go.dev/github.com/moby/swarmkit/v2@v2.0.0-20250103191802-8c1959736554/api/validation#MaxSecretSize).
as defined in [MaxSecretSize](https://pkg.go.dev/github.com/moby/swarmkit/v2@v2.0.0/api/validation#MaxSecretSize).
This field is only used to _create_ a secret, and is not returned by
other endpoints.

View File

@@ -2783,6 +2783,7 @@ definitions:
ForceUpdate:
description: "A counter that triggers an update even if no relevant parameters have been changed."
type: "integer"
format: "uint64"
Runtime:
description: "Runtime is the type of runtime specified for the task executor."
type: "string"
@@ -3333,7 +3334,7 @@ definitions:
([RFC 4648](https://tools.ietf.org/html/rfc4648#section-5)) string.
It must be empty if the Driver field is set, in which case the data is
loaded from an external secret store. The maximum allowed size is 500KB,
as defined in [MaxSecretSize](https://pkg.go.dev/github.com/moby/swarmkit/v2@v2.0.0-20250103191802-8c1959736554/api/validation#MaxSecretSize).
as defined in [MaxSecretSize](https://pkg.go.dev/github.com/moby/swarmkit/v2@v2.0.0/api/validation#MaxSecretSize).
This field is only used to _create_ a secret, and is not returned by
other endpoints.

View File

@@ -2787,6 +2787,7 @@ definitions:
ForceUpdate:
description: "A counter that triggers an update even if no relevant parameters have been changed."
type: "integer"
format: "uint64"
Runtime:
description: "Runtime is the type of runtime specified for the task executor."
type: "string"
@@ -3337,7 +3338,7 @@ definitions:
([RFC 4648](https://tools.ietf.org/html/rfc4648#section-5)) string.
It must be empty if the Driver field is set, in which case the data is
loaded from an external secret store. The maximum allowed size is 500KB,
as defined in [MaxSecretSize](https://pkg.go.dev/github.com/moby/swarmkit/v2@v2.0.0-20250103191802-8c1959736554/api/validation#MaxSecretSize).
as defined in [MaxSecretSize](https://pkg.go.dev/github.com/moby/swarmkit/v2@v2.0.0/api/validation#MaxSecretSize).
This field is only used to _create_ a secret, and is not returned by
other endpoints.

View File

@@ -2797,6 +2797,7 @@ definitions:
ForceUpdate:
description: "A counter that triggers an update even if no relevant parameters have been changed."
type: "integer"
format: "uint64"
Runtime:
description: "Runtime is the type of runtime specified for the task executor."
type: "string"
@@ -3365,7 +3366,7 @@ definitions:
([RFC 4648](https://tools.ietf.org/html/rfc4648#section-5)) string.
It must be empty if the Driver field is set, in which case the data is
loaded from an external secret store. The maximum allowed size is 500KB,
as defined in [MaxSecretSize](https://pkg.go.dev/github.com/moby/swarmkit/v2@v2.0.0-20250103191802-8c1959736554/api/validation#MaxSecretSize).
as defined in [MaxSecretSize](https://pkg.go.dev/github.com/moby/swarmkit/v2@v2.0.0/api/validation#MaxSecretSize).
This field is only used to _create_ a secret, and is not returned by
other endpoints.

View File

@@ -2801,6 +2801,7 @@ definitions:
ForceUpdate:
description: "A counter that triggers an update even if no relevant parameters have been changed."
type: "integer"
format: "uint64"
Runtime:
description: "Runtime is the type of runtime specified for the task executor."
type: "string"
@@ -3369,7 +3370,7 @@ definitions:
([RFC 4648](https://tools.ietf.org/html/rfc4648#section-5)) string.
It must be empty if the Driver field is set, in which case the data is
loaded from an external secret store. The maximum allowed size is 500KB,
as defined in [MaxSecretSize](https://pkg.go.dev/github.com/moby/swarmkit/v2@v2.0.0-20250103191802-8c1959736554/api/validation#MaxSecretSize).
as defined in [MaxSecretSize](https://pkg.go.dev/github.com/moby/swarmkit/v2@v2.0.0/api/validation#MaxSecretSize).
This field is only used to _create_ a secret, and is not returned by
other endpoints.

View File

@@ -2814,6 +2814,7 @@ definitions:
ForceUpdate:
description: "A counter that triggers an update even if no relevant parameters have been changed."
type: "integer"
format: "uint64"
Runtime:
description: "Runtime is the type of runtime specified for the task executor."
type: "string"
@@ -3382,7 +3383,7 @@ definitions:
([RFC 4648](https://tools.ietf.org/html/rfc4648#section-5)) string.
It must be empty if the Driver field is set, in which case the data is
loaded from an external secret store. The maximum allowed size is 500KB,
as defined in [MaxSecretSize](https://pkg.go.dev/github.com/moby/swarmkit/v2@v2.0.0-20250103191802-8c1959736554/api/validation#MaxSecretSize).
as defined in [MaxSecretSize](https://pkg.go.dev/github.com/moby/swarmkit/v2@v2.0.0/api/validation#MaxSecretSize).
This field is only used to _create_ a secret, and is not returned by
other endpoints.

View File

@@ -2817,6 +2817,7 @@ definitions:
ForceUpdate:
description: "A counter that triggers an update even if no relevant parameters have been changed."
type: "integer"
format: "uint64"
Runtime:
description: "Runtime is the type of runtime specified for the task executor."
type: "string"
@@ -3388,7 +3389,7 @@ definitions:
([RFC 4648](https://tools.ietf.org/html/rfc4648#section-5)) string.
It must be empty if the Driver field is set, in which case the data is
loaded from an external secret store. The maximum allowed size is 500KB,
as defined in [MaxSecretSize](https://pkg.go.dev/github.com/moby/swarmkit/v2@v2.0.0-20250103191802-8c1959736554/api/validation#MaxSecretSize).
as defined in [MaxSecretSize](https://pkg.go.dev/github.com/moby/swarmkit/v2@v2.0.0/api/validation#MaxSecretSize).
This field is only used to _create_ a secret, and is not returned by
other endpoints.

View File

@@ -2871,6 +2871,7 @@ definitions:
ForceUpdate:
description: "A counter that triggers an update even if no relevant parameters have been changed."
type: "integer"
format: "uint64"
Runtime:
description: "Runtime is the type of runtime specified for the task executor."
type: "string"
@@ -3442,7 +3443,7 @@ definitions:
([RFC 4648](https://tools.ietf.org/html/rfc4648#section-5)) string.
It must be empty if the Driver field is set, in which case the data is
loaded from an external secret store. The maximum allowed size is 500KB,
as defined in [MaxSecretSize](https://pkg.go.dev/github.com/moby/swarmkit/v2@v2.0.0-20250103191802-8c1959736554/api/validation#MaxSecretSize).
as defined in [MaxSecretSize](https://pkg.go.dev/github.com/moby/swarmkit/v2@v2.0.0/api/validation#MaxSecretSize).
This field is only used to _create_ a secret, and is not returned by
other endpoints.

View File

@@ -3913,6 +3913,7 @@ definitions:
A counter that triggers an update even if no relevant parameters have
been changed.
type: "integer"
format: "uint64"
Runtime:
description: |
Runtime is the type of runtime specified for the task executor.
@@ -4503,7 +4504,7 @@ definitions:
([RFC 4648](https://tools.ietf.org/html/rfc4648#section-5)) string.
It must be empty if the Driver field is set, in which case the data is
loaded from an external secret store. The maximum allowed size is 500KB,
as defined in [MaxSecretSize](https://pkg.go.dev/github.com/moby/swarmkit/v2@v2.0.0-20250103191802-8c1959736554/api/validation#MaxSecretSize).
as defined in [MaxSecretSize](https://pkg.go.dev/github.com/moby/swarmkit/v2@v2.0.0/api/validation#MaxSecretSize).
This field is only used to _create_ a secret, and is not returned by
other endpoints.

View File

@@ -4039,6 +4039,7 @@ definitions:
A counter that triggers an update even if no relevant parameters have
been changed.
type: "integer"
format: "uint64"
Runtime:
description: |
Runtime is the type of runtime specified for the task executor.
@@ -4627,7 +4628,7 @@ definitions:
([RFC 4648](https://tools.ietf.org/html/rfc4648#section-5)) string.
It must be empty if the Driver field is set, in which case the data is
loaded from an external secret store. The maximum allowed size is 500KB,
as defined in [MaxSecretSize](https://pkg.go.dev/github.com/moby/swarmkit/v2@v2.0.0-20250103191802-8c1959736554/api/validation#MaxSecretSize).
as defined in [MaxSecretSize](https://pkg.go.dev/github.com/moby/swarmkit/v2@v2.0.0/api/validation#MaxSecretSize).
This field is only used to _create_ a secret, and is not returned by
other endpoints.
@@ -7948,7 +7949,18 @@ paths:
default: ""
- name: "outputs"
in: "query"
description: "BuildKit output configuration"
description: |
BuildKit output configuration in the format of a stringified JSON array of objects.
Each object must have two top-level properties: `Type` and `Attrs`.
The `Type` property must be set to 'moby'.
The `Attrs` property is a map of attributes for the BuildKit output configuration.
See https://docs.docker.com/build/exporters/oci-docker/ for more information.
Example:
```
[{"Type":"moby","Attrs":{"type":"image","force-compression":"true","compression":"zstd"}}]
```
type: "string"
default: ""
- name: "version"

View File

@@ -4204,6 +4204,7 @@ definitions:
A counter that triggers an update even if no relevant parameters have
been changed.
type: "integer"
format: "uint64"
Runtime:
description: |
Runtime is the type of runtime specified for the task executor.
@@ -4876,7 +4877,7 @@ definitions:
([RFC 4648](https://tools.ietf.org/html/rfc4648#section-5)) string.
It must be empty if the Driver field is set, in which case the data is
loaded from an external secret store. The maximum allowed size is 500KB,
as defined in [MaxSecretSize](https://pkg.go.dev/github.com/moby/swarmkit/v2@v2.0.0-20250103191802-8c1959736554/api/validation#MaxSecretSize).
as defined in [MaxSecretSize](https://pkg.go.dev/github.com/moby/swarmkit/v2@v2.0.0/api/validation#MaxSecretSize).
This field is only used to _create_ a secret, and is not returned by
other endpoints.
@@ -8237,7 +8238,18 @@ paths:
default: ""
- name: "outputs"
in: "query"
description: "BuildKit output configuration"
description: |
BuildKit output configuration in the format of a stringified JSON array of objects.
Each object must have two top-level properties: `Type` and `Attrs`.
The `Type` property must be set to 'moby'.
The `Attrs` property is a map of attributes for the BuildKit output configuration.
See https://docs.docker.com/build/exporters/oci-docker/ for more information.
Example:
```
[{"Type":"moby","Attrs":{"type":"image","force-compression":"true","compression":"zstd"}}]
```
type: "string"
default: ""
- name: "version"

View File

@@ -4223,6 +4223,7 @@ definitions:
A counter that triggers an update even if no relevant parameters have
been changed.
type: "integer"
format: "uint64"
Runtime:
description: |
Runtime is the type of runtime specified for the task executor.
@@ -4895,7 +4896,7 @@ definitions:
([RFC 4648](https://tools.ietf.org/html/rfc4648#section-5)) string.
It must be empty if the Driver field is set, in which case the data is
loaded from an external secret store. The maximum allowed size is 500KB,
as defined in [MaxSecretSize](https://pkg.go.dev/github.com/moby/swarmkit/v2@v2.0.0-20250103191802-8c1959736554/api/validation#MaxSecretSize).
as defined in [MaxSecretSize](https://pkg.go.dev/github.com/moby/swarmkit/v2@v2.0.0/api/validation#MaxSecretSize).
This field is only used to _create_ a secret, and is not returned by
other endpoints.
@@ -8487,7 +8488,18 @@ paths:
default: ""
- name: "outputs"
in: "query"
description: "BuildKit output configuration"
description: |
BuildKit output configuration in the format of a stringified JSON array of objects.
Each object must have two top-level properties: `Type` and `Attrs`.
The `Type` property must be set to 'moby'.
The `Attrs` property is a map of attributes for the BuildKit output configuration.
See https://docs.docker.com/build/exporters/oci-docker/ for more information.
Example:
```
[{"Type":"moby","Attrs":{"type":"image","force-compression":"true","compression":"zstd"}}]
```
type: "string"
default: ""
- name: "version"

View File

@@ -4254,6 +4254,7 @@ definitions:
A counter that triggers an update even if no relevant parameters have
been changed.
type: "integer"
format: "uint64"
Runtime:
description: |
Runtime is the type of runtime specified for the task executor.
@@ -4926,7 +4927,7 @@ definitions:
([RFC 4648](https://tools.ietf.org/html/rfc4648#section-5)) string.
It must be empty if the Driver field is set, in which case the data is
loaded from an external secret store. The maximum allowed size is 500KB,
as defined in [MaxSecretSize](https://pkg.go.dev/github.com/moby/swarmkit/v2@v2.0.0-20250103191802-8c1959736554/api/validation#MaxSecretSize).
as defined in [MaxSecretSize](https://pkg.go.dev/github.com/moby/swarmkit/v2@v2.0.0/api/validation#MaxSecretSize).
This field is only used to _create_ a secret, and is not returned by
other endpoints.
@@ -8505,7 +8506,18 @@ paths:
default: ""
- name: "outputs"
in: "query"
description: "BuildKit output configuration"
description: |
BuildKit output configuration in the format of a stringified JSON array of objects.
Each object must have two top-level properties: `Type` and `Attrs`.
The `Type` property must be set to 'moby'.
The `Attrs` property is a map of attributes for the BuildKit output configuration.
See https://docs.docker.com/build/exporters/oci-docker/ for more information.
Example:
```
[{"Type":"moby","Attrs":{"type":"image","force-compression":"true","compression":"zstd"}}]
```
type: "string"
default: ""
- name: "version"

View File

@@ -4322,6 +4322,7 @@ definitions:
A counter that triggers an update even if no relevant parameters have
been changed.
type: "integer"
format: "uint64"
Runtime:
description: |
Runtime is the type of runtime specified for the task executor.
@@ -5041,7 +5042,7 @@ definitions:
([RFC 4648](https://tools.ietf.org/html/rfc4648#section-5)) string.
It must be empty if the Driver field is set, in which case the data is
loaded from an external secret store. The maximum allowed size is 500KB,
as defined in [MaxSecretSize](https://pkg.go.dev/github.com/moby/swarmkit/v2@v2.0.0-20250103191802-8c1959736554/api/validation#MaxSecretSize).
as defined in [MaxSecretSize](https://pkg.go.dev/github.com/moby/swarmkit/v2@v2.0.0/api/validation#MaxSecretSize).
This field is only used to _create_ a secret, and is not returned by
other endpoints.
@@ -8662,7 +8663,18 @@ paths:
default: ""
- name: "outputs"
in: "query"
description: "BuildKit output configuration"
description: |
BuildKit output configuration in the format of a stringified JSON array of objects.
Each object must have two top-level properties: `Type` and `Attrs`.
The `Type` property must be set to 'moby'.
The `Attrs` property is a map of attributes for the BuildKit output configuration.
See https://docs.docker.com/build/exporters/oci-docker/ for more information.
Example:
```
[{"Type":"moby","Attrs":{"type":"image","force-compression":"true","compression":"zstd"}}]
```
type: "string"
default: ""
- name: "version"

View File

@@ -4308,6 +4308,7 @@ definitions:
A counter that triggers an update even if no relevant parameters have
been changed.
type: "integer"
format: "uint64"
Runtime:
description: |
Runtime is the type of runtime specified for the task executor.
@@ -5027,7 +5028,7 @@ definitions:
([RFC 4648](https://tools.ietf.org/html/rfc4648#section-5)) string.
It must be empty if the Driver field is set, in which case the data is
loaded from an external secret store. The maximum allowed size is 500KB,
as defined in [MaxSecretSize](https://pkg.go.dev/github.com/moby/swarmkit/v2@v2.0.0-20250103191802-8c1959736554/api/validation#MaxSecretSize).
as defined in [MaxSecretSize](https://pkg.go.dev/github.com/moby/swarmkit/v2@v2.0.0/api/validation#MaxSecretSize).
This field is only used to _create_ a secret, and is not returned by
other endpoints.
@@ -8648,7 +8649,18 @@ paths:
default: ""
- name: "outputs"
in: "query"
description: "BuildKit output configuration"
description: |
BuildKit output configuration in the format of a stringified JSON array of objects.
Each object must have two top-level properties: `Type` and `Attrs`.
The `Type` property must be set to 'moby'.
The `Attrs` property is a map of attributes for the BuildKit output configuration.
See https://docs.docker.com/build/exporters/oci-docker/ for more information.
Example:
```
[{"Type":"moby","Attrs":{"type":"image","force-compression":"true","compression":"zstd"}}]
```
type: "string"
default: ""
- name: "version"

View File

@@ -4361,6 +4361,7 @@ definitions:
A counter that triggers an update even if no relevant parameters have
been changed.
type: "integer"
format: "uint64"
Runtime:
description: |
Runtime is the type of runtime specified for the task executor.
@@ -5086,7 +5087,7 @@ definitions:
([RFC 4648](https://tools.ietf.org/html/rfc4648#section-5)) string.
It must be empty if the Driver field is set, in which case the data is
loaded from an external secret store. The maximum allowed size is 500KB,
as defined in [MaxSecretSize](https://pkg.go.dev/github.com/moby/swarmkit/v2@v2.0.0-20250103191802-8c1959736554/api/validation#MaxSecretSize).
as defined in [MaxSecretSize](https://pkg.go.dev/github.com/moby/swarmkit/v2@v2.0.0/api/validation#MaxSecretSize).
This field is only used to _create_ a secret, and is not returned by
other endpoints.
@@ -8769,7 +8770,18 @@ paths:
default: ""
- name: "outputs"
in: "query"
description: "BuildKit output configuration"
description: |
BuildKit output configuration in the format of a stringified JSON array of objects.
Each object must have two top-level properties: `Type` and `Attrs`.
The `Type` property must be set to 'moby'.
The `Attrs` property is a map of attributes for the BuildKit output configuration.
See https://docs.docker.com/build/exporters/oci-docker/ for more information.
Example:
```
[{"Type":"moby","Attrs":{"type":"image","force-compression":"true","compression":"zstd"}}]
```
type: "string"
default: ""
- name: "version"

View File

@@ -4379,6 +4379,7 @@ definitions:
A counter that triggers an update even if no relevant parameters have
been changed.
type: "integer"
format: "uint64"
Runtime:
description: |
Runtime is the type of runtime specified for the task executor.
@@ -5104,7 +5105,7 @@ definitions:
([RFC 4648](https://tools.ietf.org/html/rfc4648#section-5)) string.
It must be empty if the Driver field is set, in which case the data is
loaded from an external secret store. The maximum allowed size is 500KB,
as defined in [MaxSecretSize](https://pkg.go.dev/github.com/moby/swarmkit/v2@v2.0.0-20250103191802-8c1959736554/api/validation#MaxSecretSize).
as defined in [MaxSecretSize](https://pkg.go.dev/github.com/moby/swarmkit/v2@v2.0.0/api/validation#MaxSecretSize).
This field is only used to _create_ a secret, and is not returned by
other endpoints.
@@ -8910,7 +8911,18 @@ paths:
default: ""
- name: "outputs"
in: "query"
description: "BuildKit output configuration"
description: |
BuildKit output configuration in the format of a stringified JSON array of objects.
Each object must have two top-level properties: `Type` and `Attrs`.
The `Type` property must be set to 'moby'.
The `Attrs` property is a map of attributes for the BuildKit output configuration.
See https://docs.docker.com/build/exporters/oci-docker/ for more information.
Example:
```
[{"Type":"moby","Attrs":{"type":"image","force-compression":"true","compression":"zstd"}}]
```
type: "string"
default: ""
- name: "version"

View File

@@ -3039,7 +3039,8 @@ definitions:
be used. If multiple endpoints have the same priority, endpoints are
lexicographically sorted based on their network name, and the one
that sorts first is picked.
type: "number"
type: "integer"
format: "int64"
example:
- 10
@@ -4517,6 +4518,7 @@ definitions:
A counter that triggers an update even if no relevant parameters have
been changed.
type: "integer"
format: "uint64"
Runtime:
description: |
Runtime is the type of runtime specified for the task executor.
@@ -5512,7 +5514,7 @@ definitions:
([RFC 4648](https://tools.ietf.org/html/rfc4648#section-5)) string.
It must be empty if the Driver field is set, in which case the data is
loaded from an external secret store. The maximum allowed size is 500KB,
as defined in [MaxSecretSize](https://pkg.go.dev/github.com/moby/swarmkit/v2@v2.0.0-20250103191802-8c1959736554/api/validation#MaxSecretSize).
as defined in [MaxSecretSize](https://pkg.go.dev/github.com/moby/swarmkit/v2@v2.0.0/api/validation#MaxSecretSize).
This field is only used to _create_ a secret, and is not returned by
other endpoints.
@@ -9454,7 +9456,18 @@ paths:
default: ""
- name: "outputs"
in: "query"
description: "BuildKit output configuration"
description: |
BuildKit output configuration in the format of a stringified JSON array of objects.
Each object must have two top-level properties: `Type` and `Attrs`.
The `Type` property must be set to 'moby'.
The `Attrs` property is a map of attributes for the BuildKit output configuration.
See https://docs.docker.com/build/exporters/oci-docker/ for more information.
Example:
```
[{"Type":"moby","Attrs":{"type":"image","force-compression":"true","compression":"zstd"}}]
```
type: "string"
default: ""
- name: "version"

View File

@@ -3039,7 +3039,8 @@ definitions:
be used. If multiple endpoints have the same priority, endpoints are
lexicographically sorted based on their network name, and the one
that sorts first is picked.
type: "number"
type: "integer"
format: "int64"
example:
- 10
@@ -4517,6 +4518,7 @@ definitions:
A counter that triggers an update even if no relevant parameters have
been changed.
type: "integer"
format: "uint64"
Runtime:
description: |
Runtime is the type of runtime specified for the task executor.
@@ -5512,7 +5514,7 @@ definitions:
([RFC 4648](https://tools.ietf.org/html/rfc4648#section-5)) string.
It must be empty if the Driver field is set, in which case the data is
loaded from an external secret store. The maximum allowed size is 500KB,
as defined in [MaxSecretSize](https://pkg.go.dev/github.com/moby/swarmkit/v2@v2.0.0-20250103191802-8c1959736554/api/validation#MaxSecretSize).
as defined in [MaxSecretSize](https://pkg.go.dev/github.com/moby/swarmkit/v2@v2.0.0/api/validation#MaxSecretSize).
This field is only used to _create_ a secret, and is not returned by
other endpoints.
@@ -9454,7 +9456,18 @@ paths:
default: ""
- name: "outputs"
in: "query"
description: "BuildKit output configuration"
description: |
BuildKit output configuration in the format of a stringified JSON array of objects.
Each object must have two top-level properties: `Type` and `Attrs`.
The `Type` property must be set to 'moby'.
The `Attrs` property is a map of attributes for the BuildKit output configuration.
See https://docs.docker.com/build/exporters/oci-docker/ for more information.
Example:
```
[{"Type":"moby","Attrs":{"type":"image","force-compression":"true","compression":"zstd"}}]
```
type: "string"
default: ""
- name: "version"

View File

@@ -2914,7 +2914,8 @@ definitions:
be used. If multiple endpoints have the same priority, endpoints are
lexicographically sorted based on their network name, and the one
that sorts first is picked.
type: "number"
type: "integer"
format: "int64"
example:
- 10
@@ -4392,6 +4393,7 @@ definitions:
A counter that triggers an update even if no relevant parameters have
been changed.
type: "integer"
format: "uint64"
Runtime:
description: |
Runtime is the type of runtime specified for the task executor.
@@ -5387,7 +5389,7 @@ definitions:
([RFC 4648](https://tools.ietf.org/html/rfc4648#section-5)) string.
It must be empty if the Driver field is set, in which case the data is
loaded from an external secret store. The maximum allowed size is 500KB,
as defined in [MaxSecretSize](https://pkg.go.dev/github.com/moby/swarmkit/v2@v2.0.0-20250103191802-8c1959736554/api/validation#MaxSecretSize).
as defined in [MaxSecretSize](https://pkg.go.dev/github.com/moby/swarmkit/v2@v2.0.0/api/validation#MaxSecretSize).
This field is only used to _create_ a secret, and is not returned by
other endpoints.
@@ -9338,7 +9340,18 @@ paths:
default: ""
- name: "outputs"
in: "query"
description: "BuildKit output configuration"
description: |
BuildKit output configuration in the format of a stringified JSON array of objects.
Each object must have two top-level properties: `Type` and `Attrs`.
The `Type` property must be set to 'moby'.
The `Attrs` property is a map of attributes for the BuildKit output configuration.
See https://docs.docker.com/build/exporters/oci-docker/ for more information.
Example:
```
[{"Type":"moby","Attrs":{"type":"image","force-compression":"true","compression":"zstd"}}]
```
type: "string"
default: ""
- name: "version"

13443
api/docs/v1.51.yaml Normal file

File diff suppressed because it is too large Load Diff

13428
api/docs/v1.52.yaml Normal file

File diff suppressed because it is too large Load Diff

15
api/go.mod Normal file
View File

@@ -0,0 +1,15 @@
module github.com/moby/moby/api
go 1.23.0
require (
github.com/docker/go-connections v0.6.0
github.com/docker/go-units v0.5.0
github.com/google/go-cmp v0.5.9
github.com/moby/docker-image-spec v1.3.1
github.com/opencontainers/go-digest v1.0.0
github.com/opencontainers/image-spec v1.1.1
golang.org/x/time v0.11.0
gotest.tools/v3 v3.5.2
pgregory.net/rapid v1.2.0
)

18
api/go.sum Normal file
View File

@@ -0,0 +1,18 @@
github.com/docker/go-connections v0.6.0 h1:LlMG9azAe1TqfR7sO+NJttz1gy6KO7VJBh+pMmjSD94=
github.com/docker/go-connections v0.6.0/go.mod h1:AahvXYshr6JgfUJGdDCs2b5EZG/vmaMAntpSFH5BFKE=
github.com/docker/go-units v0.5.0 h1:69rxXcBk27SvSaaxTtLh/8llcHD8vYHT7WSdRZ/jvr4=
github.com/docker/go-units v0.5.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk=
github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=
github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/moby/docker-image-spec v1.3.1 h1:jMKff3w6PgbfSa69GfNg+zN/XLhfXJGnEx3Nl2EsFP0=
github.com/moby/docker-image-spec v1.3.1/go.mod h1:eKmb5VW8vQEh/BAr2yvVNvuiJuY6UIocYsFu/DxxRpo=
github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U=
github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM=
github.com/opencontainers/image-spec v1.1.1 h1:y0fUlFfIZhPF1W537XOLg0/fcx6zcHCJwooC2xJA040=
github.com/opencontainers/image-spec v1.1.1/go.mod h1:qpqAh3Dmcf36wStyyWU+kCeDgrGnAve2nCC8+7h8Q0M=
golang.org/x/time v0.11.0 h1:/bpjEDfN9tkoN/ryeYHnv5hcMlc8ncjMcM4XBk5NWV0=
golang.org/x/time v0.11.0/go.mod h1:CDIdPxbZBQxdj6cxyCIdrNogrJKMJ7pr37NYpMcMDSg=
gotest.tools/v3 v3.5.2 h1:7koQfIKdy+I8UTetycgUqXWSDwpgv193Ka+qRsmBY8Q=
gotest.tools/v3 v3.5.2/go.mod h1:LtdLGcnqToBH83WByAAi/wiwSFCArdFIUV/xxN4pcjA=
pgregory.net/rapid v1.2.0 h1:keKAYRcjm+e1F0oAuU5F5+YPAWcyxNNRK2wud503Gnk=
pgregory.net/rapid v1.2.0/go.mod h1:PY5XlDGj0+V1FCq0o192FdRhpKHGTRIWBgqjDBTrq04=

View File

@@ -23,7 +23,7 @@ type Progress struct {
// Aux contains extra information not presented to the user, such as
// digests for push signing.
Aux interface{}
Aux any
LastUpdate bool
}
@@ -71,7 +71,7 @@ func Update(out Output, id, action string) {
// Updatef is a convenience function to write a printf-formatted progress update
// to the channel.
func Updatef(out Output, id, format string, a ...interface{}) {
func Updatef(out Output, id, format string, a ...any) {
Update(out, id, fmt.Sprintf(format, a...))
}
@@ -82,12 +82,12 @@ func Message(out Output, id, message string) {
// Messagef is a convenience function to write a printf-formatted progress
// message to the channel.
func Messagef(out Output, id, format string, a ...interface{}) {
func Messagef(out Output, id, format string, a ...any) {
Message(out, id, fmt.Sprintf(format, a...))
}
// Aux sends auxiliary information over a progress interface, which will not be
// formatted for the UI. This is used for things such as push signing.
func Aux(out Output, a interface{}) {
func Aux(out Output, a any) {
out.WriteProgress(Progress{Aux: a})
}

View File

@@ -14,16 +14,13 @@ import (
type StdType byte
const (
// Stdin represents standard input stream type.
Stdin StdType = iota
// Stdout represents standard output stream type.
Stdout
// Stderr represents standard error steam type.
Stderr
// Systemerr represents errors originating from the system that make it
// into the multiplexed stream.
Systemerr
Stdin StdType = 0 // Stdin represents standard input stream. It is present for completeness and should NOT be used. When reading the stream with [StdCopy] it is output on [Stdout].
Stdout StdType = 1 // Stdout represents standard output stream.
Stderr StdType = 2 // Stderr represents standard error steam.
Systemerr StdType = 3 // Systemerr represents errors originating from the system. When reading the stream with [StdCopy] it is returned as an error.
)
const (
stdWriterPrefixLen = 8
stdWriterFdIndex = 0
stdWriterSizeIndex = 4
@@ -31,7 +28,7 @@ const (
startingBufLen = 32*1024 + stdWriterPrefixLen + 1
)
var bufPool = &sync.Pool{New: func() interface{} { return bytes.NewBuffer(nil) }}
var bufPool = &sync.Pool{New: func() any { return bytes.NewBuffer(nil) }}
// stdWriter is wrapper of io.Writer with extra customized info.
type stdWriter struct {
@@ -39,10 +36,11 @@ type stdWriter struct {
prefix byte
}
// Write sends the buffer to the underneath writer.
// Write sends the buffer to the underlying writer.
// It inserts the prefix header before the buffer,
// so stdcopy.StdCopy knows where to multiplex the output.
// It makes stdWriter to implement io.Writer.
// so [StdCopy] knows where to multiplex the output.
//
// It implements [io.Writer].
func (w *stdWriter) Write(p []byte) (int, error) {
if w == nil || w.Writer == nil {
return 0, errors.New("writer not instantiated")
@@ -68,30 +66,55 @@ func (w *stdWriter) Write(p []byte) (int, error) {
return n, err
}
// NewStdWriter instantiates a new Writer.
// Everything written to it will be encapsulated using a custom format,
// and written to the underlying `w` stream.
// This allows multiple write streams (e.g. stdout and stderr) to be muxed into a single connection.
// `t` indicates the id of the stream to encapsulate.
// It can be stdcopy.Stdin, stdcopy.Stdout, stdcopy.Stderr.
func NewStdWriter(w io.Writer, t StdType) io.Writer {
// NewStdWriter instantiates a new writer using a custom format to multiplex
// multiple streams to a single writer. All messages written using this writer
// are encapsulated using a custom format, and written to the underlying
// stream "w".
//
// Writers created through NewStdWriter allow for multiple write streams
// (e.g., stdout ([Stdout]) and stderr ([Stderr]) to be multiplexed into a
// single connection. "streamType" indicates the type of stream to encapsulate,
// commonly, [Stdout] or [Stderr]. The [Systemerr] stream can be used to
// include server-side errors in the stream. Information on this stream
// is returned as an error by [StdCopy] and terminates processing the
// stream.
//
// The [Stdin] stream is present for completeness and should generally
// NOT be used. It is output on [Stdout] when reading the stream with
// [StdCopy].
//
// All streams must share the same underlying [io.Writer] to ensure proper
// multiplexing. Each call to NewStdWriter wraps that shared writer with
// a header indicating the target stream.
func NewStdWriter(w io.Writer, streamType StdType) io.Writer {
return &stdWriter{
Writer: w,
prefix: byte(t),
prefix: byte(streamType),
}
}
// StdCopy is a modified version of io.Copy.
// StdCopy is a modified version of [io.Copy] to de-multiplex messages
// from "multiplexedSource" and copy them to destination streams
// "destOut" and "destErr".
//
// StdCopy will demultiplex `src`, assuming that it contains two streams,
// previously multiplexed together using a StdWriter instance.
// As it reads from `src`, StdCopy will write to `dstout` and `dsterr`.
// StdCopy demultiplexes "multiplexedSource", assuming that it contains
// two streams, previously multiplexed using a writer created with
// [NewStdWriter].
//
// StdCopy will read until it hits EOF on `src`. It will then return a nil error.
// In other words: if `err` is non nil, it indicates a real underlying error.
// As it reads from "multiplexedSource", StdCopy writes [Stdout] messages
// to "destOut", and [Stderr] message to "destErr]. For backward-compatibility,
// [Stdin] messages are output to "destOut". The [Systemerr] stream provides
// errors produced by the daemon. It is returned as an error, and terminates
// processing the stream.
//
// `written` will hold the total number of bytes written to `dstout` and `dsterr`.
func StdCopy(dstout, dsterr io.Writer, src io.Reader) (written int64, _ error) {
// StdCopy it reads until it hits [io.EOF] on "multiplexedSource", after
// which it returns a nil error. In other words: any error returned indicates
// a real underlying error, which may be when an unknown [StdType] stream
// is received.
//
// The "written" return holds the total number of bytes written to "destOut"
// and "destErr" combined.
func StdCopy(destOut, destErr io.Writer, multiplexedSource io.Reader) (written int64, _ error) {
var (
buf = make([]byte, startingBufLen)
bufLen = len(buf)
@@ -105,7 +128,7 @@ func StdCopy(dstout, dsterr io.Writer, src io.Reader) (written int64, _ error) {
// Make sure we have at least a full header
for nr < stdWriterPrefixLen {
var nr2 int
nr2, err = src.Read(buf[nr:])
nr2, err = multiplexedSource.Read(buf[nr:])
nr += nr2
if errors.Is(err, io.EOF) {
if nr < stdWriterPrefixLen {
@@ -118,24 +141,24 @@ func StdCopy(dstout, dsterr io.Writer, src io.Reader) (written int64, _ error) {
}
}
stream := StdType(buf[stdWriterFdIndex])
// Check the first byte to know where to write
stream := StdType(buf[stdWriterFdIndex])
switch stream {
case Stdin:
fallthrough
case Stdout:
// Write on stdout
out = dstout
out = destOut
case Stderr:
// Write on stderr
out = dsterr
out = destErr
case Systemerr:
// If we're on Systemerr, we won't write anywhere.
// NB: if this code changes later, make sure you don't try to write
// to outstream if Systemerr is the stream
out = nil
default:
return 0, fmt.Errorf("Unrecognized input header: %d", buf[stdWriterFdIndex])
return 0, fmt.Errorf("unrecognized stream: %d", stream)
}
// Retrieve the size of the frame
@@ -151,7 +174,7 @@ func StdCopy(dstout, dsterr io.Writer, src io.Reader) (written int64, _ error) {
// While the amount of bytes read is less than the size of the frame + header, we keep reading
for nr < frameSize+stdWriterPrefixLen {
var nr2 int
nr2, err = src.Read(buf[nr:])
nr2, err = multiplexedSource.Read(buf[nr:])
nr += nr2
if errors.Is(err, io.EOF) {
if nr < frameSize+stdWriterPrefixLen {

View File

@@ -0,0 +1,66 @@
package stdcopy_test
import (
"errors"
"fmt"
"io"
"os"
"time"
"github.com/moby/moby/api/pkg/stdcopy"
)
func ExampleNewStdWriter() {
muxReader, muxStream := io.Pipe()
defer func() { _ = muxStream.Close() }()
// Start demuxing before the daemon starts writing.
done := make(chan error, 1)
go func() {
// using os.Stdout for both, otherwise output doesn't show up in the example.
osStdout := os.Stdout
osStderr := os.Stdout
_, err := stdcopy.StdCopy(osStdout, osStderr, muxReader)
done <- err
}()
// daemon writing to stdout, stderr, and systemErr.
stdout := stdcopy.NewStdWriter(muxStream, stdcopy.Stdout)
stderr := stdcopy.NewStdWriter(muxStream, stdcopy.Stderr)
systemErr := stdcopy.NewStdWriter(muxStream, stdcopy.Systemerr)
for range 10 {
_, _ = fmt.Fprintln(stdout, "hello from stdout")
_, _ = fmt.Fprintln(stderr, "hello from stderr")
time.Sleep(50 * time.Millisecond)
}
_, _ = fmt.Fprintln(systemErr, errors.New("something went wrong"))
// Wait for the demuxer to finish.
if err := <-done; err != nil {
fmt.Println(err)
}
// Output:
// hello from stdout
// hello from stderr
// hello from stdout
// hello from stderr
// hello from stdout
// hello from stderr
// hello from stdout
// hello from stderr
// hello from stdout
// hello from stderr
// hello from stdout
// hello from stderr
// hello from stdout
// hello from stderr
// hello from stdout
// hello from stderr
// hello from stdout
// hello from stderr
// hello from stdout
// hello from stderr
// error from daemon in stream: something went wrong
}

View File

@@ -0,0 +1,247 @@
// Package streamformatter provides helper functions to format a stream.
package streamformatter
import (
"encoding/json"
"fmt"
"io"
"strings"
"sync"
"time"
"github.com/docker/go-units"
"github.com/moby/moby/api/pkg/progress"
"github.com/moby/moby/api/types/jsonstream"
)
// jsonMessage defines a message struct. It describes
// the created time, where it from, status, ID of the
// message. It's used for docker events.
//
// It is a reduced set of [jsonmessage.JSONMessage].
type jsonMessage struct {
Stream string `json:"stream,omitempty"`
Status string `json:"status,omitempty"`
Progress *jsonstream.Progress `json:"progressDetail,omitempty"`
ID string `json:"id,omitempty"`
Error *jsonstream.Error `json:"errorDetail,omitempty"`
Aux *json.RawMessage `json:"aux,omitempty"` // Aux contains out-of-band data, such as digests for push signing and image id after building.
// ErrorMessage contains errors encountered during the operation.
//
// Deprecated: this field is deprecated since docker v0.6.0 / API v1.4. Use [Error.Message] instead. This field will be omitted in a future release.
ErrorMessage string `json:"error,omitempty"` // deprecated
}
const streamNewline = "\r\n"
type jsonProgressFormatter struct{}
func appendNewline(source []byte) []byte {
return append(source, []byte(streamNewline)...)
}
// FormatStatus formats the specified objects according to the specified format (and id).
func FormatStatus(id, format string, a ...any) []byte {
str := fmt.Sprintf(format, a...)
b, err := json.Marshal(&jsonMessage{ID: id, Status: str})
if err != nil {
return FormatError(err)
}
return appendNewline(b)
}
// FormatError formats the error as a JSON object
func FormatError(err error) []byte {
jsonError, ok := err.(*jsonstream.Error)
if !ok {
jsonError = &jsonstream.Error{Message: err.Error()}
}
if b, err := json.Marshal(&jsonMessage{Error: jsonError, ErrorMessage: err.Error()}); err == nil {
return appendNewline(b)
}
return []byte(`{"error":"format error"}` + streamNewline)
}
func (sf *jsonProgressFormatter) formatStatus(id, format string, a ...any) []byte {
return FormatStatus(id, format, a...)
}
// formatProgress formats the progress information for a specified action.
func (sf *jsonProgressFormatter) formatProgress(id, action string, progress *jsonstream.Progress, aux any) []byte {
if progress == nil {
progress = &jsonstream.Progress{}
}
var auxJSON *json.RawMessage
if aux != nil {
auxJSONBytes, err := json.Marshal(aux)
if err != nil {
return nil
}
auxJSON = new(json.RawMessage)
*auxJSON = auxJSONBytes
}
b, err := json.Marshal(&jsonMessage{
Status: action,
Progress: progress,
ID: id,
Aux: auxJSON,
})
if err != nil {
return nil
}
return appendNewline(b)
}
type rawProgressFormatter struct{}
func (sf *rawProgressFormatter) formatStatus(id, format string, a ...any) []byte {
return []byte(fmt.Sprintf(format, a...) + streamNewline)
}
func rawProgressString(p *jsonstream.Progress) string {
if p == nil || (p.Current <= 0 && p.Total <= 0) {
return ""
}
if p.Total <= 0 {
switch p.Units {
case "":
return fmt.Sprintf("%8v", units.HumanSize(float64(p.Current)))
default:
return fmt.Sprintf("%d %s", p.Current, p.Units)
}
}
percentage := int(float64(p.Current)/float64(p.Total)*100) / 2
if percentage > 50 {
percentage = 50
}
numSpaces := 0
if 50-percentage > 0 {
numSpaces = 50 - percentage
}
pbBox := fmt.Sprintf("[%s>%s] ", strings.Repeat("=", percentage), strings.Repeat(" ", numSpaces))
var numbersBox string
switch {
case p.HideCounts:
case p.Units == "": // no units, use bytes
current := units.HumanSize(float64(p.Current))
total := units.HumanSize(float64(p.Total))
numbersBox = fmt.Sprintf("%8v/%v", current, total)
if p.Current > p.Total {
// remove total display if the reported current is wonky.
numbersBox = fmt.Sprintf("%8v", current)
}
default:
numbersBox = fmt.Sprintf("%d/%d %s", p.Current, p.Total, p.Units)
if p.Current > p.Total {
// remove total display if the reported current is wonky.
numbersBox = fmt.Sprintf("%d %s", p.Current, p.Units)
}
}
var timeLeftBox string
if p.Current > 0 && p.Start > 0 && percentage < 50 {
fromStart := time.Since(time.Unix(p.Start, 0))
perEntry := fromStart / time.Duration(p.Current)
left := time.Duration(p.Total-p.Current) * perEntry
timeLeftBox = " " + left.Round(time.Second).String()
}
return pbBox + numbersBox + timeLeftBox
}
func (sf *rawProgressFormatter) formatProgress(id, action string, progress *jsonstream.Progress, aux any) []byte {
if progress == nil {
progress = &jsonstream.Progress{}
}
endl := "\r"
out := rawProgressString(progress)
if out == "" {
endl += "\n"
}
return []byte(action + " " + out + endl)
}
// NewProgressOutput returns a progress.Output object that can be passed to
// progress.NewProgressReader.
func NewProgressOutput(out io.Writer) progress.Output {
return &progressOutput{sf: &rawProgressFormatter{}, out: out, newLines: true}
}
// NewJSONProgressOutput returns a progress.Output that formats output
// using JSON objects
func NewJSONProgressOutput(out io.Writer, newLines bool) progress.Output {
return &progressOutput{sf: &jsonProgressFormatter{}, out: out, newLines: newLines}
}
type formatProgress interface {
formatStatus(id, format string, a ...any) []byte
formatProgress(id, action string, progress *jsonstream.Progress, aux any) []byte
}
type progressOutput struct {
sf formatProgress
out io.Writer
newLines bool
mu sync.Mutex
}
// WriteProgress formats progress information from a ProgressReader.
func (out *progressOutput) WriteProgress(prog progress.Progress) error {
var formatted []byte
if prog.Message != "" {
formatted = out.sf.formatStatus(prog.ID, prog.Message)
} else {
jsonProgress := jsonstream.Progress{
Current: prog.Current,
Total: prog.Total,
HideCounts: prog.HideCounts,
Units: prog.Units,
}
formatted = out.sf.formatProgress(prog.ID, prog.Action, &jsonProgress, prog.Aux)
}
out.mu.Lock()
defer out.mu.Unlock()
_, err := out.out.Write(formatted)
if err != nil {
return err
}
if out.newLines && prog.LastUpdate {
_, err = out.out.Write(out.sf.formatStatus("", ""))
return err
}
return nil
}
// AuxFormatter is a streamFormatter that writes aux progress messages
type AuxFormatter struct {
io.Writer
}
// Emit emits the given interface as an aux progress message
func (sf *AuxFormatter) Emit(id string, aux any) error {
auxJSONBytes, err := json.Marshal(aux)
if err != nil {
return err
}
auxJSON := new(json.RawMessage)
*auxJSON = auxJSONBytes
msgJSON, err := json.Marshal(&jsonMessage{ID: id, Aux: auxJSON})
if err != nil {
return err
}
msgJSON = appendNewline(msgJSON)
n, err := sf.Writer.Write(msgJSON)
if n != len(msgJSON) {
return io.ErrShortWrite
}
return err
}

View File

@@ -7,9 +7,8 @@ import (
"strings"
"testing"
"github.com/docker/docker/pkg/jsonmessage"
"github.com/google/go-cmp/cmp"
"github.com/google/go-cmp/cmp/cmpopts"
"github.com/moby/moby/api/types/jsonstream"
"gotest.tools/v3/assert"
is "gotest.tools/v3/assert/cmp"
)
@@ -22,7 +21,7 @@ func TestRawProgressFormatterFormatStatus(t *testing.T) {
func TestRawProgressFormatterFormatProgress(t *testing.T) {
sf := rawProgressFormatter{}
jsonProgress := &jsonmessage.JSONProgress{
jsonProgress := &jsonstream.Progress{
Current: 15,
Total: 30,
Start: 1,
@@ -47,7 +46,7 @@ func TestFormatError(t *testing.T) {
}
func TestFormatJSONError(t *testing.T) {
err := &jsonmessage.JSONError{Code: 50, Message: "Json error"}
err := &jsonstream.Error{Code: 50, Message: "Json error"}
res := FormatError(err)
expected := `{"errorDetail":{"code":50,"message":"Json error"},"error":"Json error"}` + streamNewline
assert.Check(t, is.Equal(expected, string(res)))
@@ -55,19 +54,19 @@ func TestFormatJSONError(t *testing.T) {
func TestJsonProgressFormatterFormatProgress(t *testing.T) {
sf := &jsonProgressFormatter{}
jsonProgress := &jsonmessage.JSONProgress{
jsonProgress := &jsonstream.Progress{
Current: 15,
Total: 30,
Start: 1,
}
aux := "aux message"
res := sf.formatProgress("id", "action", jsonProgress, aux)
msg := &jsonmessage.JSONMessage{}
msg := &jsonMessage{}
assert.NilError(t, json.Unmarshal(res, msg))
rawAux := json.RawMessage(`"` + aux + `"`)
expected := &jsonmessage.JSONMessage{
expected := &jsonMessage{
ID: "id",
Status: "action",
Aux: &rawAux,
@@ -81,7 +80,6 @@ func cmpJSONMessageOpt() cmp.Option {
return path.String() == "ProgressMessage"
}
return cmp.Options{
cmpopts.IgnoreUnexported(jsonmessage.JSONProgress{}),
// Ignore deprecated property that is a derivative of Progress
cmp.FilterPath(progressMessagePath, cmp.Ignore()),
}

View File

@@ -3,8 +3,6 @@ package streamformatter
import (
"encoding/json"
"io"
"github.com/docker/docker/pkg/jsonmessage"
)
type streamWriter struct {
@@ -22,7 +20,7 @@ func (sw *streamWriter) Write(buf []byte) (int, error) {
}
func (sw *streamWriter) format(buf []byte) []byte {
msg := &jsonmessage.JSONMessage{Stream: sw.lineFormat(buf)}
msg := &jsonMessage{Stream: sw.lineFormat(buf)}
b, err := json.Marshal(msg)
if err != nil {
return FormatError(err)

View File

@@ -0,0 +1,17 @@
# commit to be tagged for new release
commit = "HEAD"
project_name = "moby"
github_repo = "moby/moby"
sub_path = "api"
ignore_deps = [ "github.com/moby/moby" ]
# previous release
previous = "v28.2.2"
pre_release = true
preface = """\
The first dedicated release for the Moby API. This release continues the 1.x
line of API compatibility with the 52nd minor release of the 1.x API.
"""

View File

@@ -1,15 +0,0 @@
package httputils
import (
"io"
"github.com/docker/docker/api/types/container"
"github.com/docker/docker/api/types/network"
)
// ContainerDecoder specifies how
// to translate an io.Reader into
// container configuration.
type ContainerDecoder interface {
DecodeConfig(src io.Reader) (*container.Config, *container.HostConfig, *network.NetworkingConfig, error)
}

View File

@@ -19,10 +19,10 @@ produces:
consumes:
- "application/json"
- "text/plain"
basePath: "/v1.51"
basePath: "/v1.52"
info:
title: "Docker Engine API"
version: "1.51"
version: "1.52"
x-logo:
url: "https://docs.docker.com/assets/images/logo-docker-main.png"
description: |
@@ -56,7 +56,7 @@ info:
is returned.
If you omit the version-prefix, the current version of the API (v1.50) is used.
For example, calling `/info` is the same as calling `/v1.51/info`. Using the
For example, calling `/info` is the same as calling `/v1.52/info`. Using the
API without a version-prefix is deprecated and will be removed in a future release.
Engine releases in the near future should support this version of the API,
@@ -173,9 +173,10 @@ tags:
x-displayName: "System"
definitions:
Port:
PortSummary:
type: "object"
description: "An open port on a container"
description: |
Describes a port-mapping between the container and the host.
required: [PrivatePort, Type]
properties:
IP:
@@ -2647,26 +2648,10 @@ definitions:
type: "string"
stream:
type: "string"
error:
type: "string"
x-nullable: true
description: |-
errors encountered during the operation.
> **Deprecated**: This field is deprecated since API v1.4, and will be omitted in a future API version. Use the information in errorDetail instead.
errorDetail:
$ref: "#/definitions/ErrorDetail"
status:
type: "string"
progress:
type: "string"
x-nullable: true
description: |-
Progress is a pre-formatted presentation of progressDetail.
> **Deprecated**: This field is deprecated since API v1.8, and will be omitted in a future API version. Use the information in progressDetail instead.
progressDetail:
$ref: "#/definitions/ProgressDetail"
aux:
@@ -2764,52 +2749,20 @@ definitions:
properties:
id:
type: "string"
error:
type: "string"
x-nullable: true
description: |-
errors encountered during the operation.
> **Deprecated**: This field is deprecated since API v1.4, and will be omitted in a future API version. Use the information in errorDetail instead.
errorDetail:
$ref: "#/definitions/ErrorDetail"
status:
type: "string"
progress:
type: "string"
x-nullable: true
description: |-
Progress is a pre-formatted presentation of progressDetail.
> **Deprecated**: This field is deprecated since API v1.8, and will be omitted in a future API version. Use the information in progressDetail instead.
progressDetail:
$ref: "#/definitions/ProgressDetail"
PushImageInfo:
type: "object"
properties:
error:
type: "string"
x-nullable: true
description: |-
errors encountered during the operation.
> **Deprecated**: This field is deprecated since API v1.4, and will be omitted in a future API version. Use the information in errorDetail instead.
errorDetail:
$ref: "#/definitions/ErrorDetail"
status:
type: "string"
progress:
type: "string"
x-nullable: true
description: |-
Progress is a pre-formatted presentation of progressDetail.
> **Deprecated**: This field is deprecated since API v1.8, and will be omitted in a future API version. Use the information in progressDetail instead.
progressDetail:
$ref: "#/definitions/ProgressDetail"
@@ -2913,7 +2866,8 @@ definitions:
be used. If multiple endpoints have the same priority, endpoints are
lexicographically sorted based on their network name, and the one
that sorts first is picked.
type: "number"
type: "integer"
format: "int64"
example:
- 10
@@ -2997,6 +2951,7 @@ definitions:
PluginMount:
type: "object"
x-go-name: "Mount"
x-nullable: false
required: [Name, Description, Settable, Source, Destination, Type, Options]
properties:
@@ -3033,6 +2988,7 @@ definitions:
PluginDevice:
type: "object"
x-go-name: "Device"
required: [Name, Description, Settable, Path]
x-nullable: false
properties:
@@ -3052,6 +3008,7 @@ definitions:
PluginEnv:
type: "object"
x-go-name: "Env"
x-nullable: false
required: [Name, Description, Settable, Value]
properties:
@@ -3068,27 +3025,12 @@ definitions:
Value:
type: "string"
PluginInterfaceType:
type: "object"
x-nullable: false
required: [Prefix, Capability, Version]
properties:
Prefix:
type: "string"
x-nullable: false
Capability:
type: "string"
x-nullable: false
Version:
type: "string"
x-nullable: false
PluginPrivilege:
description: |
Describes a permission the user has to accept upon installing
the plugin.
type: "object"
x-go-name: "PluginPrivilege"
x-go-name: "Privilege"
properties:
Name:
type: "string"
@@ -3105,6 +3047,7 @@ definitions:
Plugin:
description: "A plugin for the Engine API"
type: "object"
x-go-name: "Plugin"
required: [Settings, Enabled, Config, Name]
properties:
Id:
@@ -3122,8 +3065,9 @@ definitions:
x-nullable: false
example: true
Settings:
description: "Settings that can be modified by users."
description: "user-configurable settings for the plugin."
type: "object"
x-go-name: "Settings"
x-nullable: false
required: [Args, Devices, Env, Mounts]
properties:
@@ -3148,11 +3092,13 @@ definitions:
PluginReference:
description: "plugin remote reference used to push/pull the plugin"
type: "string"
x-go-name: "PluginReference"
x-nullable: false
example: "localhost:5000/tiborvass/sample-volume-plugin:latest"
Config:
description: "The config of a plugin."
type: "object"
x-go-name: "Config"
x-nullable: false
required:
- Description
@@ -3186,12 +3132,15 @@ definitions:
description: "The interface between Docker and the plugin"
x-nullable: false
type: "object"
x-go-name: "Interface"
required: [Types, Socket]
properties:
Types:
type: "array"
items:
$ref: "#/definitions/PluginInterfaceType"
type: "string"
x-go-type:
type: "CapabilityID"
example:
- "docker.volumedriver/1.0"
Socket:
@@ -3218,6 +3167,7 @@ definitions:
example: "/bin/"
User:
type: "object"
x-go-name: "User"
x-nullable: false
properties:
UID:
@@ -3230,6 +3180,7 @@ definitions:
example: 1000
Network:
type: "object"
x-go-name: "NetworkConfig"
x-nullable: false
required: [Type]
properties:
@@ -3239,6 +3190,7 @@ definitions:
example: "host"
Linux:
type: "object"
x-go-name: "LinuxConfig"
x-nullable: false
required: [Capabilities, AllowAllDevices, Devices]
properties:
@@ -3284,6 +3236,7 @@ definitions:
Value: "0"
Args:
type: "object"
x-go-name: "Args"
x-nullable: false
required: [Name, Description, Settable, Value]
properties:
@@ -3305,6 +3258,7 @@ definitions:
type: "string"
rootfs:
type: "object"
x-go-name: "RootFS"
properties:
type:
type: "string"
@@ -4391,6 +4345,7 @@ definitions:
A counter that triggers an update even if no relevant parameters have
been changed.
type: "integer"
format: "uint64"
Runtime:
description: |
Runtime is the type of runtime specified for the task executor.
@@ -5250,7 +5205,7 @@ definitions:
Port-mappings for the container.
type: "array"
items:
$ref: "#/definitions/Port"
$ref: "#/definitions/PortSummary"
SizeRw:
description: |-
The size of files that have been created or changed by this container.
@@ -5345,6 +5300,29 @@ definitions:
List of mounts used by the container.
items:
$ref: "#/definitions/MountPoint"
Health:
type: "object"
description: |-
Summary of health status
Added in v1.52, before that version all container summary not include Health.
After this attribute introduced, it includes containers with no health checks configured,
or containers that are not running with none
properties:
Status:
type: "string"
description: |-
the health status of the container
enum:
- "none"
- "starting"
- "healthy"
- "unhealthy"
example: "healthy"
FailingStreak:
description: "FailingStreak is the number of consecutive failures"
type: "integer"
example: 0
Driver:
description: "Driver represents a driver (network, logging, secrets)."
@@ -5386,7 +5364,7 @@ definitions:
([RFC 4648](https://tools.ietf.org/html/rfc4648#section-5)) string.
It must be empty if the Driver field is set, in which case the data is
loaded from an external secret store. The maximum allowed size is 500KB,
as defined in [MaxSecretSize](https://pkg.go.dev/github.com/moby/swarmkit/v2@v2.0.0-20250103191802-8c1959736554/api/validation#MaxSecretSize).
as defined in [MaxSecretSize](https://pkg.go.dev/github.com/moby/swarmkit/v2@v2.0.0/api/validation#MaxSecretSize).
This field is only used to _create_ a secret, and is not returned by
other endpoints.
@@ -9337,7 +9315,18 @@ paths:
default: ""
- name: "outputs"
in: "query"
description: "BuildKit output configuration"
description: |
BuildKit output configuration in the format of a stringified JSON array of objects.
Each object must have two top-level properties: `Type` and `Attrs`.
The `Type` property must be set to 'moby'.
The `Attrs` property is a map of attributes for the BuildKit output configuration.
See https://docs.docker.com/build/exporters/oci-docker/ for more information.
Example:
```
[{"Type":"moby","Attrs":{"type":"image","force-compression":"true","compression":"zstd"}}]
```
type: "string"
default: ""
- name: "version"
@@ -9369,15 +9358,7 @@ paths:
- "application/json"
operationId: "BuildPrune"
parameters:
- name: "keep-storage"
in: "query"
description: |
Amount of disk space in bytes to keep for cache
> **Deprecated**: This parameter is deprecated and has been renamed to "reserved-space".
> It is kept for backward compatibility and will be removed in API v1.49.
type: "integer"
format: "int64"
- name: "reserved-space"
in: "query"
description: "Amount of disk space in bytes to keep for cache"
@@ -10419,7 +10400,10 @@ paths:
type: "string"
required: true
- name: "platform"
type: "string"
type: "array"
items:
type: "string"
collectionFormat: "multi"
in: "query"
description: |
JSON encoded OCI platform describing a platform which will be used
@@ -10464,13 +10448,16 @@ paths:
items:
type: "string"
- name: "platform"
type: "string"
type: "array"
items:
type: "string"
collectionFormat: "multi"
in: "query"
description: |
JSON encoded OCI platform describing a platform which will be used
to select a platform-specific image to be saved if the image is
multi-platform.
If not provided, the full multi-platform image will be saved.
JSON encoded OCI platform(s) which will be used to select the
platform-specific image(s) to be saved if the image is
multi-platform. If not provided, the full multi-platform image
will be saved.
Example: `{"os": "linux", "architecture": "arm", "variant": "v5"}`
tags: ["Image"]
@@ -10506,13 +10493,16 @@ paths:
type: "boolean"
default: false
- name: "platform"
type: "string"
type: "array"
items:
type: "string"
collectionFormat: "multi"
in: "query"
description: |
JSON encoded OCI platform describing a platform which will be used
to select a platform-specific image to be load if the image is
multi-platform.
If not provided, the full multi-platform image will be loaded.
JSON encoded OCI platform(s) which will be used to select the
platform-specific image(s) to load if the image is
multi-platform. If not provided, the full multi-platform image
will be loaded.
Example: `{"os": "linux", "architecture": "arm", "variant": "v5"}`
tags: ["Image"]

133
api/templates/schema.gotmpl Normal file
View File

@@ -0,0 +1,133 @@
{{- if and .IsBaseType .IsExported (not .IsSuperAlias) }}
{{- template "schemaPolymorphic" . }}
{{- else if .IsSuperAlias }}
type {{ pascalize .Name }} {{ template "typeSchemaType" . }}{{/* For types declared as $ref on some other type, just declare the type as a golang _aliased_ type, e.g. type A = B. No method shall be redeclared. */}}
{{- if .IsBaseType }}
{{ template "baseTypeSerializer" . }}{{/* When the alias redeclares a polymorphic type, define factory methods with this alias. */}}
{{- end }}
{{- else if .IsEmbedded }}
{{- template "schemaEmbedded" . }}
{{- else }}
{{- if or .IsComplexObject .IsTuple .IsAdditionalProperties }}{{/* TODO(fred): handle case of subtype inheriting from base type with AdditionalProperties, issue #2220 */}}
{{ if .Name }}type {{ if not .IsExported }}{{ .Name }}{{ else }}{{ pascalize .Name }}{{ end }}{{ end }} {{ template "schemaBody" . }}
{{- range .Properties }}
{{- if .IsBaseType }}
// {{ pascalize .Name}} gets the {{ humanize .Name }} of this base type{{/* all properties which are of a base type propagate its interface */}}
func ({{ $.ReceiverName}} *{{ pascalize $.Name}}) {{ pascalize .Name}}() {{ template "schemaType" . }}{
{{- if eq $.DiscriminatorField .Name }}
return {{ printf "%q" $.DiscriminatorValue }}
{{- else }}
return {{ $.ReceiverName }}.{{camelize .Name}}Field
{{- end }}
}
// Set{{ pascalize .Name}} sets the {{ humanize .Name }} of this base type
func ({{ $.ReceiverName}} *{{ pascalize $.Name}}) Set{{ pascalize .Name}}(val {{ template "schemaType" . }}) {
{{- if ne $.DiscriminatorField .Name }}
{{ $.ReceiverName }}.{{camelize .Name}}Field = val
{{- end }}
}
{{- end }}
{{- end }}
{{- if .Default }}{{/* TODO(fred) - issue #2189 */}}
func ({{.ReceiverName}} *{{ pascalize .Name }}) UnmarshalJSON(b []byte) error {
type {{ pascalize .Name }}Alias {{ pascalize .Name }}
var t {{ pascalize .Name }}Alias
if err := json.Unmarshal([]byte({{printf "%q" (json .Default)}}), &t); err != nil {
return err
}
if err := json.Unmarshal(b, &t); err != nil {
return err
}
*{{.ReceiverName}} = {{ pascalize .Name }}(t)
return nil
}
{{- end }}
{{- else }}
type {{ pascalize .Name }} {{ template "typeSchemaType" . }}
{{- end }}
{{- if (and .IsPrimitive .IsAliased .IsCustomFormatter (not (stringContains .Zero "(\""))) }}
{{ template "aliasedSerializer" . }}
{{- end }}
{{- if .IsSubType }}
{{ range .AllOf }}
{{ range .Properties }}
{{- if .IsBaseType }}
// {{ pascalize .Name}} gets the {{ humanize .Name }} of this subtype
func ({{$.ReceiverName}} *{{ pascalize $.Name}}) {{ pascalize .Name}}() {{ template "schemaType" . }}{
{{- if eq $.DiscriminatorField .Name }}
return {{ printf "%q" $.DiscriminatorValue }}
{{- else }}
return {{ $.ReceiverName }}.{{camelize .Name}}Field
{{- end }}
}
// Set{{ pascalize .Name}} sets the {{ humanize .Name }} of this subtype
func ({{$.ReceiverName}} *{{ pascalize $.Name}}) Set{{ pascalize .Name}}(val {{ template "schemaType" . }}) {
{{- if ne $.DiscriminatorField .Name }}
{{ $.ReceiverName }}.{{camelize .Name}}Field = val
{{- end }}
}
{{- end }}
{{- end }}{{/* TODO(fred): handle AdditionalProperties in base type */}}
{{- end }}
{{ template "mapOrSliceGetter" . }}
{{- end }}
{{ template "schemaSerializer" . }}
{{- end }}
{{- if and .IncludeValidator (not .IsSuperAlias) (not .IsEmbedded) }}{{/* aliased types type A = B do not redefine methods */}}
{{- if and (not (or .IsInterface .IsStream)) (or .Required .HasValidations .HasBaseType) }}
{{- if (eq .SwaggerType "string") }}{{/* Enum factory for enums for which we generate const (atm, only strings)*/}}
{{- if .Enum }}
func New{{ pascalize .Name }}(value {{ .GoType }}) *{{ .GoType }} {
return &value
}
// Pointer returns a pointer to a freshly-allocated {{ .GoType }}.
func ({{ .ReceiverName }} {{ .GoType }}) Pointer() *{{ .GoType }} {
return &{{ .ReceiverName }}
}
{{- end }}
{{- end }}
{{ if false }}{{ template "schemavalidator" . }}{{ end }}
{{- else if and false not (or .IsInterface .IsStream) }}
// Validate validates this {{ humanize .Name }}{{/* this schema implements the runtime.Validatable interface but has no validations to check */}}
func ({{.ReceiverName}} {{ if or .IsTuple .IsComplexObject .IsAdditionalProperties }}*{{ end }}{{ if or (not .IsExported) .Discriminates }}{{ camelize .Name }}{{ else }}{{ pascalize .Name }}{{ end }}) Validate(formats strfmt.Registry) error {
return nil
}
{{- else }}{{/* {{ .Name }} does not implement the runtime.Validatable interface: noop */}}
{{- end }}
{{- if false }}
{{- if and (not (or .IsInterface .IsStream)) (or .HasContextValidations) }}
{{ template "schemacontextvalidator" . }}
{{- else if not (or .IsInterface .IsStream) }}
// ContextValidate validates this {{ humanize .Name }} based on context it is used {{/* this schema implements the runtime.ContextValidatable interface but has no validations to check */}}
func ({{.ReceiverName}} {{ if or .IsTuple .IsComplexObject .IsAdditionalProperties }}*{{ end }}{{ if or (not .IsExported) .Discriminates }}{{ camelize .Name }}{{ else }}{{ pascalize .Name }}{{ end }}) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
return nil
}
{{- else }}{{/* {{ .Name }} does not implement the runtime.Validatable interface: noop */}}
{{- end }}
{{- end }}
{{- if .WantsMarshalBinary }}
{{ template "marshalBinarySerializer" . }}
{{- end }}
{{- end }}
{{- define "mapOrSliceGetter" }}{{/* signature for AdditionalProperties and AdditionalItems getter funcs */}}
{{- if not .IsBaseType }}
{{- if .HasAdditionalProperties }}
{{- with .AdditionalProperties }}
// {{- template "docstring" . }}{{- template "propertyValidationDocString" . }}
{{ pascalize .Name }}() map[string]{{ template "schemaType" . }}
{{- end }}
{{- end }}
{{- with .AdditionalItems }}
// {{- template "docstring" . }}{{- template "propertyValidationDocString" . }}
{{ pascalize .Name }}() []{{ template "schemaType" . }}
{{- end }}
{{- else }}
// AdditionalProperties in base type shoud be handled just like regular properties{{/* TODO(fred): add full support for AdditionalProperties in base type */}}
// At this moment, the base type property is pushed down to the subtype
{{- end }}
{{- end }}

View File

@@ -0,0 +1 @@
{{ define "marshalBinarySerializer" }}{{ end }}

View File

@@ -18,6 +18,7 @@ import (
{{ range .ExtraSchemas }}
// {{ .Name }} {{ comment .Description }}
//
// swagger:model {{ .Name }}
{{ template "schema" . }}
{{ end }}
{{- template "schema" . }}
{{- end }}

View File

@@ -3,8 +3,8 @@ package build
import (
"io"
"github.com/docker/docker/api/types/container"
"github.com/docker/docker/api/types/registry"
"github.com/moby/moby/api/types/container"
"github.com/moby/moby/api/types/registry"
)
// BuilderVersion sets the version of underlying builder to use

View File

@@ -3,7 +3,7 @@ package build
import (
"time"
"github.com/docker/docker/api/types/filters"
"github.com/moby/moby/api/types/filters"
)
// CacheRecord contains information about a build cache record.
@@ -40,8 +40,6 @@ type CachePruneOptions struct {
MaxUsedSpace int64
MinFreeSpace int64
Filters filters.Args
KeepStorage int64 // Deprecated: deprecated in API 1.48.
}
// CachePruneReport contains the response for Engine API:

View File

@@ -1,85 +0,0 @@
package types
import (
"bufio"
"context"
"net"
)
// NewHijackedResponse initializes a [HijackedResponse] type.
func NewHijackedResponse(conn net.Conn, mediaType string) HijackedResponse {
return HijackedResponse{Conn: conn, Reader: bufio.NewReader(conn), mediaType: mediaType}
}
// HijackedResponse holds connection information for a hijacked request.
type HijackedResponse struct {
mediaType string
Conn net.Conn
Reader *bufio.Reader
}
// Close closes the hijacked connection and reader.
func (h *HijackedResponse) Close() {
h.Conn.Close()
}
// MediaType let client know if HijackedResponse hold a raw or multiplexed stream.
// returns false if HTTP Content-Type is not relevant, and container must be inspected
func (h *HijackedResponse) MediaType() (string, bool) {
if h.mediaType == "" {
return "", false
}
return h.mediaType, true
}
// CloseWriter is an interface that implements structs
// that close input streams to prevent from writing.
type CloseWriter interface {
CloseWrite() error
}
// CloseWrite closes a readWriter for writing.
func (h *HijackedResponse) CloseWrite() error {
if conn, ok := h.Conn.(CloseWriter); ok {
return conn.CloseWrite()
}
return nil
}
// PluginRemoveOptions holds parameters to remove plugins.
type PluginRemoveOptions struct {
Force bool
}
// PluginEnableOptions holds parameters to enable plugins.
type PluginEnableOptions struct {
Timeout int
}
// PluginDisableOptions holds parameters to disable plugins.
type PluginDisableOptions struct {
Force bool
}
// PluginInstallOptions holds parameters to install a plugin.
type PluginInstallOptions struct {
Disabled bool
AcceptAllPermissions bool
RegistryAuth string // RegistryAuth is the base64 encoded credentials for the registry
RemoteRef string // RemoteRef is the plugin name on the registry
// PrivilegeFunc is a function that clients can supply to retry operations
// after getting an authorization error. This function returns the registry
// authentication header value in base64 encoded format, or an error if the
// privilege request fails.
//
// For details, refer to [github.com/docker/docker/api/types/registry.RequestAuthConfig].
PrivilegeFunc func(context.Context) (string, error)
AcceptPermissionsFunc func(context.Context, PluginPrivileges) (bool, error)
Args []string
}
// PluginCreateOptions hold all options to plugin create.
type PluginCreateOptions struct {
RepoName string
}

View File

@@ -1,9 +1,13 @@
package types
// Code generated by go-swagger; DO NOT EDIT.
package common
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
// ErrorResponse Represents an error.
// Example: {"message":"Something went wrong."}
//
// swagger:model ErrorResponse
type ErrorResponse struct {

View File

@@ -1,4 +1,4 @@
package types
package common
// Error returns the error message
func (e ErrorResponse) Error() string {

View File

@@ -1,9 +1,12 @@
// Code generated by go-swagger; DO NOT EDIT.
package common
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
// IDResponse Response to an API call that returns just an Id
//
// swagger:model IDResponse
type IDResponse struct {

View File

@@ -1,3 +1,5 @@
// Code generated by go-swagger; DO NOT EDIT.
package container
// This file was generated by the swagger tool.

View File

@@ -1,6 +1,6 @@
package container
import "github.com/docker/docker/api/types/common"
import "github.com/moby/moby/api/types/common"
// CommitResponse response for the commit API call, containing the ID of the
// image that was produced.

View File

@@ -3,8 +3,6 @@ package container
import (
"time"
"github.com/docker/docker/api/types/strslice"
"github.com/docker/go-connections/nat"
dockerspec "github.com/moby/docker-image-spec/specs-go/v1"
)
@@ -48,18 +46,18 @@ type Config struct {
AttachStdin bool // Attach the standard input, makes possible user interaction
AttachStdout bool // Attach the standard output
AttachStderr bool // Attach the standard error
ExposedPorts nat.PortSet `json:",omitempty"` // List of exposed ports
ExposedPorts PortSet `json:",omitempty"` // List of exposed ports
Tty bool // Attach standard streams to a tty, including stdin if it is not closed.
OpenStdin bool // Open stdin
StdinOnce bool // If true, close stdin after the 1 attached client disconnects.
Env []string // List of environment variable to set in the container
Cmd strslice.StrSlice // Command to run when starting the container
Cmd []string // Command to run when starting the container
Healthcheck *HealthConfig `json:",omitempty"` // Healthcheck describes how to check the container is healthy
ArgsEscaped bool `json:",omitempty"` // True if command is already escaped (meaning treat as a command line) (Windows specific).
Image string // Name of the image as it was passed by the operator (e.g. could be symbolic)
Volumes map[string]struct{} // List of volumes (mounts) used for the container
WorkingDir string // Current directory (PWD) in the command will be launched
Entrypoint strslice.StrSlice // Entrypoint to run when starting the container
Entrypoint []string // Entrypoint to run when starting the container
NetworkDisabled bool `json:",omitempty"` // Is network disabled
// Mac Address of the container.
//
@@ -69,5 +67,5 @@ type Config struct {
Labels map[string]string // List of labels set to this container
StopSignal string `json:",omitempty"` // Signal to stop a container
StopTimeout *int `json:",omitempty"` // Timeout (in seconds) to stop a container
Shell strslice.StrSlice `json:",omitempty"` // Shell for shell-form of RUN, CMD, ENTRYPOINT
Shell []string `json:",omitempty"` // Shell for shell-form of RUN, CMD, ENTRYPOINT
}

View File

@@ -1,25 +1,14 @@
package container
import (
"io"
"os"
"time"
"github.com/docker/docker/api/types/mount"
"github.com/docker/docker/api/types/storage"
"github.com/moby/moby/api/types/mount"
"github.com/moby/moby/api/types/storage"
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
)
// ContainerUpdateOKBody OK response to ContainerUpdate operation
//
// Deprecated: use [UpdateResponse]. This alias will be removed in the next release.
type ContainerUpdateOKBody = UpdateResponse
// ContainerTopOKBody OK response to ContainerTop operation
//
// Deprecated: use [TopResponse]. This alias will be removed in the next release.
type ContainerTopOKBody = TopResponse
// PruneReport contains the response for Engine API:
// POST "/containers/prune"
type PruneReport struct {
@@ -45,23 +34,10 @@ type CopyToContainerOptions struct {
CopyUIDGID bool
}
// StatsResponseReader wraps an io.ReadCloser to read (a stream of) stats
// for a container, as produced by the GET "/stats" endpoint.
//
// The OSType field is set to the server's platform to allow
// platform-specific handling of the response.
//
// TODO(thaJeztah): remove this wrapper, and make OSType part of [StatsResponse].
type StatsResponseReader struct {
Body io.ReadCloser `json:"body"`
OSType string `json:"ostype"`
}
// MountPoint represents a mount point configuration inside the container.
// This is used for reporting the mountpoints in use by a container.
type MountPoint struct {
// Type is the type of mount, see `Type<foo>` definitions in
// github.com/docker/docker/api/types/mount.Type
// Type is the type of mount, see [mount.Type] definitions for details.
Type mount.Type `json:",omitempty"`
// Name is the name reference to the underlying data defined by `Source`
@@ -128,7 +104,7 @@ type Summary struct {
ImageManifestDescriptor *ocispec.Descriptor `json:"ImageManifestDescriptor,omitempty"`
Command string
Created int64
Ports []Port
Ports []PortSummary
SizeRw int64 `json:",omitempty"`
SizeRootFs int64 `json:",omitempty"`
Labels map[string]string
@@ -138,6 +114,7 @@ type Summary struct {
NetworkMode string `json:",omitempty"`
Annotations map[string]string `json:",omitempty"`
}
Health *HealthSummary `json:",omitempty"`
NetworkSettings *NetworkSettingsSummary
Mounts []MountPoint
}

View File

@@ -1,6 +1,6 @@
package container
import "github.com/docker/docker/api/types/network"
import "github.com/moby/moby/api/types/network"
// CreateRequest is the request message sent to the server for container
// create calls. It is a config wrapper that holds the container [Config]

View File

@@ -1,3 +1,5 @@
// Code generated by go-swagger; DO NOT EDIT.
package container
// This file was generated by the swagger tool.
@@ -5,15 +7,18 @@ package container
// CreateResponse ContainerCreateResponse
//
// OK response to ContainerCreate operation
// # OK response to ContainerCreate operation
//
// swagger:model CreateResponse
type CreateResponse struct {
// The ID of the created container
// Example: ede54ee1afda366ab42f824e8a5ffd195155d853ceaec74a927f249ea270c743
// Required: true
ID string `json:"Id"`
// Warnings encountered when creating the container
// Example: []
// Required: true
Warnings []string `json:"Warnings"`
}

View File

@@ -1,6 +1,6 @@
package container
import "github.com/docker/docker/api/types/common"
import "github.com/moby/moby/api/types/common"
// ExecCreateResponse is the response for a successful exec-create request.
// It holds the ID of the exec that was created.
@@ -18,11 +18,13 @@ type ExecOptions struct {
AttachStdin bool // Attach the standard input, makes possible user interaction
AttachStderr bool // Attach the standard error
AttachStdout bool // Attach the standard output
Detach bool // Execute in detach mode
DetachKeys string // Escape keys for detach
Env []string // Environment variables
WorkingDir string // Working directory
Cmd []string // Execution commands and args
// Deprecated: the Detach field is not used, and will be removed in a future release.
Detach bool
}
// ExecStartOptions is a temp struct used by execStart
@@ -42,10 +44,42 @@ type ExecStartOptions struct {
type ExecAttachOptions = ExecStartOptions
// ExecInspect holds information returned by exec inspect.
//
// It is used by the client to unmarshal a [ExecInspectResponse],
// but currently only provides a subset of the information included
// in that type.
//
// TODO(thaJeztah): merge [ExecInspect] and [ExecInspectResponse],
type ExecInspect struct {
ExecID string `json:"ID"`
ContainerID string
Running bool
ExitCode int
Pid int
ContainerID string `json:"ContainerID"`
Running bool `json:"Running"`
ExitCode int `json:"ExitCode"`
Pid int `json:"Pid"`
}
// ExecInspectResponse is the API response for the "GET /exec/{id}/json"
// endpoint and holds information about and exec.
type ExecInspectResponse struct {
ID string `json:"ID"`
Running bool `json:"Running"`
ExitCode *int `json:"ExitCode"`
ProcessConfig *ExecProcessConfig
OpenStdin bool `json:"OpenStdin"`
OpenStderr bool `json:"OpenStderr"`
OpenStdout bool `json:"OpenStdout"`
CanRemove bool `json:"CanRemove"`
ContainerID string `json:"ContainerID"`
DetachKeys []byte `json:"DetachKeys"`
Pid int `json:"Pid"`
}
// ExecProcessConfig holds information about the exec process
// running on the host.
type ExecProcessConfig struct {
Tty bool `json:"tty"`
Entrypoint string `json:"entrypoint"`
Arguments []string `json:"arguments"`
Privileged *bool `json:"privileged,omitempty"`
User string `json:"user,omitempty"`
}

View File

@@ -1,3 +1,5 @@
// Code generated by go-swagger; DO NOT EDIT.
package container
// This file was generated by the swagger tool.

View File

@@ -26,6 +26,12 @@ type Health struct {
Log []*HealthcheckResult // Log contains the last few results (oldest first)
}
// HealthSummary stores a summary of the container's healthcheck results.
type HealthSummary struct {
Status HealthStatus // Status is one of [NoHealthcheck], [Starting], [Healthy] or [Unhealthy].
FailingStreak int // FailingStreak is the number of consecutive failures
}
// HealthcheckResult stores information about a single run of a healthcheck probe
type HealthcheckResult struct {
Start time.Time // Start is the time this check started

View File

@@ -5,12 +5,10 @@ import (
"fmt"
"strings"
"github.com/docker/docker/api/types/blkiodev"
"github.com/docker/docker/api/types/mount"
"github.com/docker/docker/api/types/network"
"github.com/docker/docker/api/types/strslice"
"github.com/docker/go-connections/nat"
"github.com/docker/go-units"
"github.com/moby/moby/api/types/blkiodev"
"github.com/moby/moby/api/types/mount"
"github.com/moby/moby/api/types/network"
)
// CgroupnsMode represents the cgroup namespace mode of the container
@@ -427,7 +425,7 @@ type HostConfig struct {
ContainerIDFile string // File (path) where the containerId is written
LogConfig LogConfig // Configuration of the logs for this container
NetworkMode NetworkMode // Network mode to use for the container
PortBindings nat.PortMap // Port mapping between the exposed port (container) and the host
PortBindings PortMap // Port mapping between the exposed port (container) and the host
RestartPolicy RestartPolicy // Restart policy to be used for the container
AutoRemove bool // Automatically remove container when it exits
VolumeDriver string // Name of the volume driver used to mount volumes
@@ -436,8 +434,8 @@ type HostConfig struct {
Annotations map[string]string `json:",omitempty"` // Arbitrary non-identifying metadata attached to container and provided to the runtime
// Applicable to UNIX platforms
CapAdd strslice.StrSlice // List of kernel capabilities to add to the container
CapDrop strslice.StrSlice // List of kernel capabilities to remove from the container
CapAdd []string // List of kernel capabilities to add to the container
CapDrop []string // List of kernel capabilities to remove from the container
CgroupnsMode CgroupnsMode // Cgroup namespace mode to use for the container
DNS []string `json:"Dns"` // List of DNS server to lookup
DNSOptions []string `json:"DnsOptions"` // List of DNSOption to look for

View File

@@ -2,7 +2,7 @@
package container
import "github.com/docker/docker/api/types/network"
import "github.com/moby/moby/api/types/network"
// IsValid indicates if an isolation technology is valid
func (i Isolation) IsValid() bool {

View File

@@ -1,6 +1,6 @@
package container
import "github.com/docker/docker/api/types/network"
import "github.com/moby/moby/api/types/network"
// IsValid indicates if an isolation technology is valid
func (i Isolation) IsValid() bool {

View File

@@ -0,0 +1,24 @@
package container
import "github.com/docker/go-connections/nat"
// PortRangeProto is a string containing port number and protocol in the format "80/tcp",
// or a port range and protocol in the format "80-83/tcp".
//
// It is currently an alias for [nat.Port] but may become a concrete type in a future release.
type PortRangeProto = nat.Port
// PortSet is a collection of structs indexed by [HostPort].
//
// It is currently an alias for [nat.PortSet] but may become a concrete type in a future release.
type PortSet = nat.PortSet
// PortBinding represents a binding between a Host IP address and a [HostPort].
//
// It is currently an alias for [nat.PortBinding] but may become a concrete type in a future release.
type PortBinding = nat.PortBinding
// PortMap is a collection of [PortBinding] indexed by [HostPort].
//
// It is currently an alias for [nat.PortMap] but may become a concrete type in a future release.
type PortMap = nat.PortMap

View File

@@ -1,8 +1,7 @@
package container
import (
"github.com/docker/docker/api/types/network"
"github.com/docker/go-connections/nat"
"github.com/moby/moby/api/types/network"
)
// NetworkSettings exposes the network settings in the api
@@ -14,10 +13,10 @@ type NetworkSettings struct {
// NetworkSettingsBase holds networking state for a container when inspecting it.
type NetworkSettingsBase struct {
Bridge string // Bridge contains the name of the default bridge interface iff it was set through the daemon --bridge flag.
SandboxID string // SandboxID uniquely represents a container's network stack
SandboxKey string // SandboxKey identifies the sandbox
Ports nat.PortMap // Ports is a collection of PortBinding indexed by Port
Bridge string // Bridge contains the name of the default bridge interface iff it was set through the daemon --bridge flag.
SandboxID string // SandboxID uniquely represents a container's network stack
SandboxKey string // SandboxKey identifies the sandbox
Ports PortMap // Ports is a collection of PortBinding indexed by Port
// HairpinMode specifies if hairpin NAT should be enabled on the virtual interface
//

View File

@@ -1,6 +1,6 @@
package container
import "github.com/docker/docker/api/types/filters"
import "github.com/moby/moby/api/types/filters"
// ResizeOptions holds parameters to resize a TTY.
// It can be used to resize container TTYs and

View File

@@ -1,11 +1,16 @@
// Code generated by go-swagger; DO NOT EDIT.
package container
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
// Port An open port on a container
// swagger:model Port
type Port struct {
// PortSummary Describes a port-mapping between the container and the host.
//
// Example: {"PrivatePort":8080,"PublicPort":80,"Type":"tcp"}
//
// swagger:model PortSummary
type PortSummary struct {
// Host IP address that the container's port is mapped to
IP string `json:"IP,omitempty"`
@@ -19,5 +24,6 @@ type Port struct {
// type
// Required: true
// Enum: ["tcp","udp","sctp"]
Type string `json:"Type"`
}

Some files were not shown because too many files have changed in this diff Show More