300 Commits

Author SHA1 Message Date
Paweł Gronowski
1489cb3ae0 Merge pull request #51722 from vvoland/modernize
Modernize Go code
2025-12-16 12:38:36 +00:00
Rob Murray
25fbe6cd43 Merge pull request #51725 from robmry/max-api-1.53
Update client MaxAPIVersion to 1.53
2025-12-16 11:14:41 +00:00
Rob Murray
1e209e788b Continue to backfill empty PortBindings in API 1.53
- introduced by commit 0ca7ac3 ("daemon: backfill empty PBs
  slices for backward compat")

Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-12-16 11:03:58 +00:00
Rob Murray
bdda339294 Merge pull request #51574 from 2003Aditya/TestAPINetworkInspectWithScope
migrate TestAPINetworkInspectWithScope to integration test
2025-12-15 20:53:15 +00:00
Paweł Gronowski
a25907b485 modernize: Prefer strings.SplitSeq instead of Split
Avoids extra allocations. Added in Go 1.24.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-12-15 18:56:33 +01:00
Aditya Mishra
29d5098ffd migrate TestAPINetworkInspectWithScope to integration test
Signed-off-by: Aditya Mishra <mishraaditya675@gmail.com>
2025-12-13 23:24:31 +05:30
Akihiro Suda
cc30833181 integration: increase timeout
Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2025-12-08 12:39:14 +09:00
Sebastiaan van Stijn
dae3650dcc client: rename/deprecate WithVersion, WithVersionFromEnv
Add WithAPIVersion and WithAPIVersionFromEnv to be more clear on
the intent, and to align with other related options and fields.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-11-12 22:39:05 +01:00
Austin Vazquez
a087d03e0c client: refactor create network api implementation to wrap options/results
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-10-30 23:45:18 -05:00
Austin Vazquez
860307c4ea client: refactor ServerVersion to return ServerVersionResult
Co-Authored-By: Claude <noreply@anthropic.com>
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-30 14:22:41 +01:00
Austin Vazquez
e9f28e2a41 client: refactor NetworkConnect, NetworkDisconnect, NetworkRemove
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-29 13:02:01 +01:00
Austin Vazquez
c5ddef1122 client: refactor ContainerList to wrap result
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-10-28 18:52:52 -05:00
Sebastiaan van Stijn
1f5c82b9fa client: add option and output structs for various container methods
Add option- and output structs for;

- Client.ContainerKill
- Client.ContainerPause
- Client.ContainerRemove
- Client.ContainerResize
- Client.ContainerRestart
- Client.ContainerStart
- Client.ContainerStop
- Client.ContainerUnpause

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-27 23:46:28 +01:00
Sebastiaan van Stijn
425975313a client: merge ContainerInspectWithRaw with ContainerInspect
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-24 22:01:23 +02:00
Sebastiaan van Stijn
f9082484c9 Merge pull request #51278 from vvoland/client-container-opts2
client_(attach,commit,create,diff): Wrap result and options
2025-10-24 13:41:23 +02:00
Austin Vazquez
f40e1a7582 api: move types/versions to client/pkg and daemon/internal
This change moves the api/types/versions package out into client and daemon versions.

Co-authored-by: Claude <noreply@anthropic.com>
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-10-23 19:22:31 -05:00
Paweł Gronowski
3340c86db9 client/container_create: Rename ContainerName to Name
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-10-23 21:11:30 +02:00
Paweł Gronowski
bd31b8b1c7 client_(attach,commit,create,diff): Wrap result and options
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-10-23 21:11:30 +02:00
Albin Kerouanton
37ac6cec6c Merge pull request #50114 from danegsta/50107-defaultpoolsize
Proposal: Allow specifying the subnet size for networks allocated from default pools
2025-10-23 08:53:38 +02:00
Austin Vazquez
5a5d39205c client: rename ServiceListResult.Services to ServiceListResult.Items
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-10-22 15:55:03 -05:00
David Negstad
ea0d934ff2 Allow requesting networks with a custom prefix size from the default pools
Signed-off-by: David Negstad <David.Negstad@microsoft.com>
2025-10-22 12:45:55 -07:00
Paweł Gronowski
7ceea4148a client/node: Wrap options and output
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-10-22 12:02:05 +02:00
Austin Vazquez
cd08b79c02 client: refactor service api client functions for defined options/result structs
Co-authored-by: Claude <noreply@anthropic.com>
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-10-21 19:18:07 -05:00
Sebastiaan van Stijn
f5b0ce3988 integration/network: TestServiceWithDefaultAddressPoolInit fix log
This log was logging the whole inspect-response, including the "Raw" field;

    === RUN   TestServiceWithDefaultAddressPoolInit
        service_test.go:448: TestServiceWithDefaultAddressPoolInit: NetworkInspect: {Network:{Network:{Name:sthiraTestServiceWithDefaultAddressPoolInit ID:j4k7ql2dbyycbyew1i7fiyif3 Created:2025-10-21 19:00:32.418877317 +0000 UTC Scope:swarm Driver:overlay EnableIPv4:true EnableIPv6:false IPAM:{Driver:default Options:map[] Config:[{Subnet:20.20.1.0/24 IPRange:invalid Prefix Gateway:20.20.1.1 AuxAddress:map[]}]} Internal:false Attachable:false Ingress:false ConfigFrom:{Network:} ConfigOnly:false Options:map[com.docker.network.driver.overlay.vxlanid_list:4097] Labels:map[] Peers:[{Name:661bf7d013f3 IP:127.0.0.1}]} Containers:map[27af69f425142a8916c35f2d3a0ad4b7ea100db2d8309cfb8fb1fd65c1fd0bc1:{Name:TestServiceTestServiceWithDefaultAddressPoolInit.1.kss6lqx8nspg0o42evczitpda EndpointID:692933d4206760cd24b46a3df036dc2b3b8f87bc6f8fc711528a041f95fef084 MacAddress:02:42:14:14:01:03 IPv4Address:20.20.1.3/24 IPv6Address:invalid Prefix} lb-sthiraTestServiceWithDefaultAddressPoolInit:{Name:sthiraTestServiceWithDefaultAddressPoolInit-endpoint EndpointID:4685f15d277e748004bd963919fb34d9ea110415e7267ac68d5900f3dd8abb5d MacAddress:02:42:14:14:01:04 IPv4Address:20.20.1.4/24 IPv6Address:invalid Prefix}] Services:map[TestServiceTestServiceWithDefaultAddressPoolInit:{VIP:20.20.1.2 Ports:[] LocalLBIndex:256 Tasks:[{Name:TestServiceTestServiceWithDefaultAddressPoolInit.1.kss6lqx8nspg0o42evczitpda EndpointID:692933d4206760cd24b46a3df036dc2b3b8f87bc6f8fc711528a041f95fef084 EndpointIP:20.20.1.3 Info:map[Host IP:127.0.0.1]}]}] Status:0xc0001341d0} Raw:[123 34 78 97 109 101 34 58 34 115 116 104 105 114 97 84 101 115 116 83 101 114 118 105 99 101 87 105 116 104 68 101 102 97 117 108 116 65 100 100 114 101 115 115 80 111 111 108 73 110 105 116 34 44 34 73 100 34 58 34 106 52 107 55 113 108 50 100 98 121 121 99 98 121 101 119 49 105 55 102 105 121 105 102 51 34 44 34 67 114 101 97 116 101 100 34 58 34 50 48 50 53 45 49 48 45 50 49 84 49 57 58 48 48 58 51 50 46 52 49 56 56 55 55 51 49 55 90 34 44 34 83 99 111 112 101 34 58 34 115 119 97 114 109 34 44 34 68 114 105 118 101 114 34 58 34 111 118 101 114 108 97 121 34 44 34 69 110 97 98 108 101 73 80 118 52 34 58 116 114 117 101 44 34 69 110 97 98 108 101 73 80 118 54 34 58 102 97 108 115 101 44 34 73 80 65 77 34 58 123 34 68 114 105 118 101 114 34 58 34 100 101 102 97 117 108 116 34 44 34 79 112 116 105 111 110 115 34 58 110 117 108 108 44 34 67 111 110 102 105 103 34 58 91 123 34 83 117 98 110 101 116 34 58 34 50 48 46 50 48 46 49 46 48 47 50 52 34 44 34 73 80 82 97 110 103 101 34 58 34 34 44 34 71 97 116 101 119 97 121 34 58 34 50 48 46 50 48 46 49 46 49 34 125 93 125 44 34 73 110 116 101 114 110 97 108 34 58 102 97 108 115 101 44 34 65 116 116 97 99 104 97 98 108 101 34 58 102 97 108 115 101 44 34 73 110 103 114 101 115 115 34 58 102 97 108 115 101 44 34 67 111 110 102 105 103 70 114 111 109 34 58 123 34 78 101 116 119 111 114 107 34 58 34 34 125 44 34 67 111 110 102 105 103 79 110 108 121 34 58 102 97 108 115 101 44 34 79 112 116 105 111 110 115 34 58 123 34 99 111 109 46 100 111 99 107 101 114 46 110 101 116 119 111 114 107 46 100 114 105 118 101 114 46 111 118 101 114 108 97 121 46 118 120 108 97 110 105 100 95 108 105 115 116 34 58 34 52 48 57 55 34 125 44 34 76 97 98 101 108 115 34 58 123 125 44 34 80 101 101 114 115 34 58 91 123 34 78 97 109 101 34 58 34 54 54 49 98 102 55 100 48 49 51 102 51 34 44 34 73 80 34 58 34 49 50 55 46 48 46 48 46 49 34 125 93 44 34 67 111 110 116 97 105 110 101 114 115 34 58 123 34 50 55 97 102 54 57 102 52 50 53 49 52 50 97 56 57 49 54 99 51 53 102 50 100 51 97 48 97 100 52 98 55 101 97 49 48 48 100 98 50 100 56 51 48 57 99 102 98 56 102 98 49 102 100 54 53 99 49 102 100 48 98 99 49 34 58 123 34 78 97 109 101 34 58 34 84 101 115 116 83 101 114 118 105 99 101 84 101 115 116 83 101 114 118 105 99 101 87 105 116 104 68 101 102 97 117 108 116 65 100 100 114 101 115 115 80 111 111 108 73 110 105 116 46 49 46 107 115 115 54 108 113 120 56 110 115 112 103 48 111 52 50 101 118 99 122 105 116 112 100 97 34 44 34 69 110 100 112 111 105 110 116 73 68 34 58 34 54 57 50 57 51 51 100 52 50 48 54 55 54 48 99 100 50 52 98 52 54 97 51 100 102 48 51 54 100 99 50 98 51 98 56 102 56 55 98 99 54 102 56 102 99 55 49 49 53 50 56 97 48 52 49 102 57 53 102 101 102 48 56 52 34 44 34 77 97 99 65 100 100 114 101 115 115 34 58 34 48 50 58 52 50 58 49 52 58 49 52 58 48 49 58 48 51 34 44 34 73 80 118 52 65 100 100 114 101 115 115 34 58 34 50 48 46 50 48 46 49 46 51 47 50 52 34 44 34 73 80 118 54 65 100 100 114 101 115 115 34 58 34 34 125 44 34 108 98 45 115 116 104 105 114 97 84 101 115 116 83 101 114 118 105 99 101 87 105 116 104 68 101 102 97 117 108 116 65 100 100 114 101 115 115 80 111 111 108 73 110 105 116 34 58 123 34 78 97 109 101 34 58 34 115 116 104 105 114 97 84 101 115 116 83 101 114 118 105 99 101 87 105 116 104 68 101 102 97 117 108 116 65 100 100 114 101 115 115 80 111 111 108 73 110 105 116 45 101 110 100 112 111 105 110 116 34 44 34 69 110 100 112 111 105 110 116 73 68 34 58 34 52 54 56 53 102 49 53 100 50 55 55 101 55 52 56 48 48 52 98 100 57 54 51 57 49 57 102 98 51 52 100 57 101 97 49 49 48 52 49 53 101 55 50 54 55 97 99 54 56 100 53 57 48 48 102 51 100 100 56 97 98 98 53 100 34 44 34 77 97 99 65 100 100 114 101 115 115 34 58 34 48 50 58 52 50 58 49 52 58 49 52 58 48 49 58 48 52 34 44 34 73 80 118 52 65 100 100 114 101 115 115 34 58 34 50 48 46 50 48 46 49 46 52 47 50 52 34 44 34 73 80 118 54 65 100 100 114 101 115 115 34 58 34 34 125 125 44 34 83 101 114 118 105 99 101 115 34 58 123 34 84 101 115 116 83 101 114 118 105 99 101 84 101 115 116 83 101 114 118 105 99 101 87 105 116 104 68 101 102 97 117 108 116 65 100 100 114 101 115 115 80 111 111 108 73 110 105 116 34 58 123 34 86 73 80 34 58 34 50 48 46 50 48 46 49 46 50 34 44 34 80 111 114 116 115 34 58 91 93 44 34 76 111 99 97 108 76 66 73 110 100 101 120 34 58 50 53 54 44 34 84 97 115 107 115 34 58 91 123 34 78 97 109 101 34 58 34 84 101 115 116 83 101 114 118 105 99 101 84 101 115 116 83 101 114 118 105 99 101 87 105 116 104 68 101 102 97 117 108 116 65 100 100 114 101 115 115 80 111 111 108 73 110 105 116 46 49 46 107 115 115 54 108 113 120 56 110 115 112 103 48 111 52 50 101 118 99 122 105 116 112 100 97 34 44 34 69 110 100 112 111 105 110 116 73 68 34 58 34 54 57 50 57 51 51 100 52 50 48 54 55 54 48 99 100 50 52 98 52 54 97 51 100 102 48 51 54 100 99 50 98 51 98 56 102 56 55 98 99 54 102 56 102 99 55 49 49 53 50 56 97 48 52 49 102 57 53 102 101 102 48 56 52 34 44 34 69 110 100 112 111 105 110 116 73 80 34 58 34 50 48 46 50 48 46 49 46 51 34 44 34 73 110 102 111 34 58 123 34 72 111 115 116 32 73 80 34 58 34 49 50 55 46 48 46 48 46 49 34 125 125 93 125 125 44 34 83 116 97 116 117 115 34 58 123 34 73 80 65 77 34 58 123 34 83 117 98 110 101 116 115 34 58 123 34 50 48 46 50 48 46 49 46 48 47 50 52 34 58 123 34 73 80 115 73 110 85 115 101 34 58 53 44 34 68 121 110 97 109 105 99 73 80 115 65 118 97 105 108 97 98 108 101 34 58 50 53 49 125 125 125 125 125 10]}

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-21 21:29:59 +02:00
Sebastiaan van Stijn
485b95600a client: NetworkList: wrap result
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-21 17:40:19 +02:00
Sebastiaan van Stijn
3fbf5a3bd1 client: NetworkInspect: wrap result and remove NetworkInspectWithRaw
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-21 17:26:24 +02:00
Sebastiaan van Stijn
e77f116c9c integration: remove some version-gates for API < v1.44
We don't run these tests against older daemons, but if we would,
we no longer have to consider API < v1.44 as versions of the daemon
below v25.0 reached EOL.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-15 00:30:05 +02:00
Rob Murray
9912ccd7b3 Clean up bridge device on network create error
When the bridge driver encounters an error during network
creation, delete the bridge device if one has been added.

Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-10-09 15:52:25 +01:00
Cory Snider
7ea066c8d1 client: add Filters type
Add a new type to use for building filter predicates for API requests,
replacing "./api/types/filters".Args in the client. Remove the now
unused api/types/filters package.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2025-10-08 12:06:31 -04:00
Austin Vazquez
ea76dbefeb api/types/swarm: deprecate PortConfigProtocol
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-10-03 17:34:00 -05:00
Austin Vazquez
c646091d57 api: move container port type to network package
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-10-03 17:30:42 -05:00
Cory Snider
fd4329a620 api/types/container: use netip types as appropriate
Signed-off-by: Cory Snider <csnider@mirantis.com>
2025-10-03 21:39:14 +02:00
Cory Snider
a90adb6dc1 api/types/network: use netip types as appropriate
And generate the ServiceInfo struct from the Swagger spec.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2025-10-03 21:39:14 +02:00
Cory Snider
cc082add87 api/types/swarm: use netip types as appropriate
Change the types for IP address and prefix struct fields to netip.Addr
and netip.Prefix for convenience. Fields such as
swarm.InitRequest.ListenAddr which may encode non-numeric values such as
a network interface name have not been modified.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2025-10-03 21:39:13 +02:00
Austin Vazquez
4279e522e1 Merge pull request #50710 from austinvazquez/define-network-port-types
api: add container network port types
2025-10-02 17:43:58 -07:00
Austin Vazquez
cb3abacc52 api/types/container: add network port and port range types
Co-authored-by: Sebastiaan van Stijn <github@gone.nl>
Co-authored-by: Cory Snider <csnider@mirantis.com>
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-10-02 13:59:34 -05:00
Sebastiaan van Stijn
3912ffacd6 integration/nw: TestEmptyPortBindingsBC use context
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-25 22:53:49 +02:00
Muhammad Daffa Dinaya
87d1da50f0 test: migrate test api network get defaults and filter
Signed-off-by: Muhammad Daffa Dinaya <muhammaddaffadinaya@gmail.com>
2025-09-20 05:58:35 +00:00
Rob Murray
07453abab3 Merge pull request #50929 from robmry/mac_ip_vlan_gateway_config
macvlan, ipvlan-l2: only configure a default route when a gateway address is supplied
2025-09-16 18:09:30 +01:00
Cory Snider
1b9ef486c7 Merge pull request #50946 from corhere/ipam-allocation-info
daemon: report IPAM status for Swarm networks
2025-09-15 13:00:32 -04:00
Rob Murray
aa78f19066 ipvlan-l2: do not allocate a gateway address from IPAM
When ipvlan in "l2" mode is given no '--gateway' option, an
address is allocated from IPAM and a default route is set up
via that gateway. But, the gateway address is not assigned to
anything in the Docker ipvlan network - it must be external,
and IPAM shouldn't try to guess it.

So ...

- always disable IPAM gateway address allocation for ipvlan-l2
  - tell libnet to assume the endpoint has a gateway instead
- update the Join code to allow for no configured gateway
- always disable 'docker_gwbridge' connection for ipvlan
  networks, so it's not hooked up when there is no gateway
  address.

Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-09-12 14:29:15 +01:00
Rob Murray
468e3521b0 macvlan: do not allocate a gateway address from IPAM
When macvlan is given no '--gateway' option, an address is
allocated from IPAM and a default route is set up via that
gateway. But, the gateway address is not assigned to anything
in the Docker macvlan network - it must be external, and
IPAM shouldn't try to guess it.

When IPv6 auto-configuration is enabled in the network the
macvlan is connected to, the macvlan driver races against it
to set up the gateway. When autoconfig wins, container creation
fails because the default route already exists.

So ...

- disable IPAM gateway address allocation for macvlan
- update the Join code to allow for no configured gateway
- always disable 'docker_gwbridge' connection for macvlan
  networks, so it's not hooked up when there is no gateway
  address.

Libnet assumes an endpoint with no statically configured default
gateway or route does not provide external connectivity. So, it
disables external DNS access, and will not select the endpoint
as gateway for containers. So, where an IPAM allocated gateway
address would have been assigned before, tell libnet to assume
there will be an auto-configured gateway.

Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-09-12 14:29:15 +01:00
Cory Snider
c2c2b80e90 daemon: report IPAM status for Swarm networks
As the Engine API requests may be directed at a non-leader Swarm
manager, the information needs to be tunneled through the Swarm API.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2025-09-11 15:25:14 -04:00
Rob Murray
8efe6b0183 Add TestJoinError
Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-09-11 14:19:21 +01:00
Rob Murray
73413ea693 bridge_linux_test.go: gofumpt
Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-09-11 14:18:18 +01:00
Cory Snider
3f86797d3f api,daemon: report IPAM status for network
On API v1.52 and newer, the GET /networks/{id} endpoint returns
statistics about the IPAM state for the subnets assigned to the network.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2025-09-10 11:06:05 -04:00
Sebastiaan van Stijn
d3e45f8743 testutil: move back to internal
This package was originally internal, but was moved out when BuildKit
used it for its integration tests. That's no longer the case, so we
can make it internal again.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-08 10:08:30 +02:00
Sebastiaan van Stijn
a45639af26 Merge pull request #50897 from thaJeztah/move_container_options
api/types/container: move container options to client
2025-09-05 09:29:56 +02:00
Sebastiaan van Stijn
4d20b6fe56 api/types/container: move container options to client
Move the option-types to the client and in some cases create a
copy for the backend. These types are used to construct query-
args, and not marshaled to JSON, and can be replaced with functional
options in the client.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-04 20:09:55 +02:00
Cory Snider
1a86389419 api/types/network: separate Summary from Inspect
While the network Summary and Inspect types have been aliases in Go's
type system, in practice there is a difference: the Containers and
Services fields are only populated when inspecting a network. Split out
the common fields into a base network.Network struct which is embedded
in the network.Summary and network.Inspect types.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2025-09-04 13:51:28 -04:00