Skip to content

Commit 290af44

Browse files
committed
go.mod: bump github.com/moby/moby/api v1.52.0, moby/client v0.1.0
Signed-off-by: Sebastiaan van Stijn <[email protected]>
1 parent 4a50857 commit 290af44

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+2022
-2244
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ example-provider: ## build example provider for e2e tests
9595
mocks:
9696
mockgen --version >/dev/null 2>&1 || go install go.uber.org/mock/[email protected]
9797
mockgen -destination pkg/mocks/mock_docker_cli.go -package mocks github.com/docker/cli/cli/command Cli
98-
mockgen -destination pkg/mocks/mock_docker_api.go -package mocks github.com/docker/docker/client APIClient
98+
mockgen -destination pkg/mocks/mock_docker_api.go -package mocks github.com/moby/moby/client APIClient
9999
mockgen -destination pkg/mocks/mock_docker_compose_api.go -package mocks -source=./pkg/api/api.go Service
100100

101101
.PHONY: e2e

cmd/compose/bridge.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ import (
2323

2424
"github.com/distribution/reference"
2525
"github.com/docker/cli/cli/command"
26-
"github.com/docker/docker/api/types/image"
27-
"github.com/docker/docker/pkg/stringid"
2826
"github.com/docker/go-units"
27+
"github.com/moby/moby/api/types/image"
28+
"github.com/moby/moby/client/pkg/stringid"
2929
"github.com/spf13/cobra"
3030

3131
"github.com/docker/compose/v5/cmd/formatter"

cmd/compose/compose.go

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ import (
3434
"github.com/compose-spec/compose-go/v2/loader"
3535
"github.com/compose-spec/compose-go/v2/types"
3636
composegoutils "github.com/compose-spec/compose-go/v2/utils"
37-
"github.com/docker/buildx/util/logutil"
3837
dockercli "github.com/docker/cli/cli"
3938
"github.com/docker/cli/cli-plugins/metadata"
4039
"github.com/docker/cli/cli/command"
@@ -421,16 +420,6 @@ func (o *BackendOptions) Add(option compose.Option) {
421420

422421
// RootCommand returns the compose command with its child commands
423422
func RootCommand(dockerCli command.Cli, backendOptions *BackendOptions) *cobra.Command { //nolint:gocyclo
424-
// filter out useless commandConn.CloseWrite warning message that can occur
425-
// when using a remote context that is unreachable: "commandConn.CloseWrite: commandconn: failed to wait: signal: killed"
426-
// https://github.com/docker/cli/blob/e1f24d3c93df6752d3c27c8d61d18260f141310c/cli/connhelper/commandconn/commandconn.go#L203-L215
427-
logrus.AddHook(logutil.NewFilter([]logrus.Level{
428-
logrus.WarnLevel,
429-
},
430-
"commandConn.CloseWrite:",
431-
"commandConn.CloseRead:",
432-
))
433-
434423
opts := ProjectOptions{}
435424
var (
436425
ansi string

cmd/compose/images.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,13 @@ import (
2727

2828
"github.com/containerd/platforms"
2929
"github.com/docker/cli/cli/command"
30-
"github.com/docker/compose/v5/pkg/compose"
31-
"github.com/docker/docker/pkg/stringid"
3230
"github.com/docker/go-units"
31+
"github.com/moby/moby/client/pkg/stringid"
3332
"github.com/spf13/cobra"
3433

3534
"github.com/docker/compose/v5/cmd/formatter"
3635
"github.com/docker/compose/v5/pkg/api"
36+
"github.com/docker/compose/v5/pkg/compose"
3737
)
3838

3939
type imageOptions struct {

cmd/compose/list.go

Lines changed: 32 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,20 @@ package compose
1818

1919
import (
2020
"context"
21+
"errors"
2122
"fmt"
2223
"io"
24+
"regexp"
2325
"strings"
2426

2527
"github.com/docker/cli/cli/command"
26-
"github.com/docker/compose/v5/cmd/formatter"
27-
"github.com/docker/compose/v5/pkg/compose"
28-
2928
"github.com/docker/cli/opts"
29+
"github.com/moby/moby/client"
3030
"github.com/spf13/cobra"
3131

32+
"github.com/docker/compose/v5/cmd/formatter"
3233
"github.com/docker/compose/v5/pkg/api"
34+
"github.com/docker/compose/v5/pkg/compose"
3335
)
3436

3537
type lsOptions struct {
@@ -62,11 +64,32 @@ var acceptedListFilters = map[string]bool{
6264
"name": true,
6365
}
6466

67+
// match returns true if any of the values at key match the source string
68+
func match(filters client.Filters, field, source string) bool {
69+
if f, ok := filters[field]; ok && f[source] {
70+
return true
71+
}
72+
73+
fieldValues := filters[field]
74+
for name2match := range fieldValues {
75+
isMatch, err := regexp.MatchString(name2match, source)
76+
if err != nil {
77+
continue
78+
}
79+
if isMatch {
80+
return true
81+
}
82+
}
83+
return false
84+
}
85+
6586
func runList(ctx context.Context, dockerCli command.Cli, backendOptions *BackendOptions, lsOpts lsOptions) error {
6687
filters := lsOpts.Filter.Value()
67-
err := filters.Validate(acceptedListFilters)
68-
if err != nil {
69-
return err
88+
89+
for filter := range filters {
90+
if _, ok := acceptedListFilters[filter]; !ok {
91+
return errors.New("invalid filter '" + filter + "'")
92+
}
7093
}
7194

7295
backend, err := compose.NewComposeService(dockerCli, backendOptions.Options...)
@@ -78,13 +101,12 @@ func runList(ctx context.Context, dockerCli command.Cli, backendOptions *Backend
78101
return err
79102
}
80103

81-
if filters.Len() > 0 {
104+
if len(filters) > 0 {
82105
var filtered []api.Stack
83106
for _, s := range stackList {
84-
if filters.Contains("name") && !filters.Match("name", s.Name) {
85-
continue
107+
if match(filters, "name", s.Name) {
108+
filtered = append(filtered, s)
86109
}
87-
filtered = append(filtered, s)
88110
}
89111
stackList = filtered
90112
}

cmd/compose/ps.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ func filterByStatus(containers []api.ContainerSummary, statuses []string) []api.
176176

177177
func hasStatus(c api.ContainerSummary, statuses []string) bool {
178178
for _, status := range statuses {
179-
if c.State == status {
179+
if string(c.State) == status {
180180
return true
181181
}
182182
}

cmd/compose/stats.go

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import (
2222

2323
"github.com/docker/cli/cli/command"
2424
"github.com/docker/cli/cli/command/container"
25-
"github.com/docker/docker/api/types/filters"
25+
"github.com/moby/moby/client"
2626
"github.com/spf13/cobra"
2727

2828
"github.com/docker/compose/v5/pkg/api"
@@ -67,18 +67,17 @@ func runStats(ctx context.Context, dockerCli command.Cli, opts statsOptions, ser
6767
if err != nil {
6868
return err
6969
}
70-
filter := []filters.KeyValuePair{
71-
filters.Arg("label", fmt.Sprintf("%s=%s", api.ProjectLabel, name)),
72-
}
70+
f := client.Filters{}
71+
f.Add("label", fmt.Sprintf("%s=%s", api.ProjectLabel, name))
72+
7373
if len(service) > 0 {
74-
filter = append(filter, filters.Arg("label", fmt.Sprintf("%s=%s", api.ServiceLabel, service[0])))
74+
f.Add("label", fmt.Sprintf("%s=%s", api.ServiceLabel, service[0]))
7575
}
76-
args := filters.NewArgs(filter...)
7776
return container.RunStats(ctx, dockerCli, &container.StatsOptions{
7877
All: opts.all,
7978
NoStream: opts.noStream,
8079
NoTrunc: opts.noTrunc,
8180
Format: opts.format,
82-
Filters: &args,
81+
Filters: f,
8382
})
8483
}

cmd/formatter/container.go

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,17 @@ package formatter
1818

1919
import (
2020
"fmt"
21+
"net/netip"
2122
"strconv"
2223
"strings"
2324
"time"
2425

2526
"github.com/docker/cli/cli/command/formatter"
26-
"github.com/docker/compose/v5/pkg/api"
27-
"github.com/docker/docker/api/types/container"
28-
"github.com/docker/docker/pkg/stringid"
2927
"github.com/docker/go-units"
28+
"github.com/moby/moby/api/types/container"
29+
"github.com/moby/moby/client/pkg/stringid"
30+
31+
"github.com/docker/compose/v5/pkg/api"
3032
)
3133

3234
const (
@@ -196,26 +198,32 @@ func (c *ContainerContext) ExitCode() int {
196198
}
197199

198200
func (c *ContainerContext) State() string {
199-
return c.c.State
201+
return string(c.c.State)
200202
}
201203

202204
func (c *ContainerContext) Status() string {
203205
return c.c.Status
204206
}
205207

206208
func (c *ContainerContext) Health() string {
207-
return c.c.Health
209+
return string(c.c.Health)
208210
}
209211

210212
func (c *ContainerContext) Publishers() api.PortPublishers {
211213
return c.c.Publishers
212214
}
213215

214216
func (c *ContainerContext) Ports() string {
215-
var ports []container.Port
217+
var ports []container.PortSummary
216218
for _, publisher := range c.c.Publishers {
217-
ports = append(ports, container.Port{
218-
IP: publisher.URL,
219+
var pIP netip.Addr
220+
if publisher.URL != "" {
221+
if p, err := netip.ParseAddr(publisher.URL); err == nil {
222+
pIP = p
223+
}
224+
}
225+
ports = append(ports, container.PortSummary{
226+
IP: pIP,
219227
PrivatePort: uint16(publisher.TargetPort),
220228
PublicPort: uint16(publisher.PublishedPort),
221229
Type: publisher.Protocol,

cmd/formatter/logs.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,9 @@ import (
2626
"time"
2727

2828
"github.com/buger/goterm"
29+
"github.com/moby/moby/client/pkg/jsonmessage"
30+
2931
"github.com/docker/compose/v5/pkg/api"
30-
"github.com/docker/docker/pkg/jsonmessage"
3132
)
3233

3334
// LogConsumer consume logs from services and format them

go.mod

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ module github.com/docker/compose/v5
22

33
go 1.24.9
44

5+
replace github.com/docker/buildx => github.com/docker/buildx v0.30.0-rc2.0.20251115102242-823e824baf2e // master / v0.31.0
6+
57
require (
68
github.com/AlecAivazis/survey/v2 v2.3.7
79
github.com/DefangLabs/secret-detector v0.0.0-20250403165618-22662109213e
@@ -15,7 +17,7 @@ require (
1517
github.com/containerd/platforms v1.0.0-rc.2
1618
github.com/distribution/reference v0.6.0
1719
github.com/docker/buildx v0.30.0
18-
github.com/docker/cli v28.5.2+incompatible
20+
github.com/docker/cli v29.0.1+incompatible
1921
github.com/docker/cli-docs-tool v0.10.0
2022
github.com/docker/docker v28.5.2+incompatible
2123
github.com/docker/go-connections v0.6.0
@@ -31,6 +33,8 @@ require (
3133
github.com/mitchellh/go-ps v1.0.0
3234
github.com/moby/buildkit v0.26.0
3335
github.com/moby/go-archive v0.1.0
36+
github.com/moby/moby/api v1.52.0
37+
github.com/moby/moby/client v0.1.0
3438
github.com/moby/patternmatcher v0.6.0
3539
github.com/moby/sys/atomicwriter v0.1.0
3640
github.com/moby/term v0.5.2
@@ -63,9 +67,7 @@ require (
6367

6468
require (
6569
github.com/Azure/go-ansiterm v0.0.0-20250102033503-faa5f7b0171c // indirect
66-
github.com/beorn7/perks v1.0.1 // indirect
6770
github.com/cenkalti/backoff/v5 v5.0.3 // indirect
68-
github.com/cespare/xxhash/v2 v2.3.0 // indirect
6971
github.com/containerd/containerd/api v1.10.0 // indirect
7072
github.com/containerd/continuity v0.4.5 // indirect
7173
github.com/containerd/errdefs/pkg v0.3.0 // indirect
@@ -74,10 +76,7 @@ require (
7476
github.com/containerd/typeurl/v2 v2.2.3 // indirect
7577
github.com/cpuguy83/go-md2man/v2 v2.0.7 // indirect
7678
github.com/davecgh/go-spew v1.1.1 // indirect
77-
github.com/docker/distribution v2.8.3+incompatible // indirect
78-
github.com/docker/docker-credential-helpers v0.9.3 // indirect
79-
github.com/docker/go v1.5.1-1.0.20160303222718-d30aec9fd63c // indirect
80-
github.com/docker/go-metrics v0.0.1 // indirect
79+
github.com/docker/docker-credential-helpers v0.9.4 // indirect
8180
github.com/felixge/httpsnoop v1.0.4 // indirect
8281
github.com/fvbommel/sortorder v1.1.0 // indirect
8382
github.com/go-logr/logr v1.4.3 // indirect
@@ -96,14 +95,11 @@ require (
9695
github.com/inhies/go-bytesize v0.0.0-20220417184213-4913239db9cf // indirect
9796
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 // indirect
9897
github.com/klauspost/compress v1.18.1 // indirect
99-
github.com/magiconair/properties v1.8.9 // indirect
10098
github.com/mattn/go-colorable v0.1.14 // indirect
10199
github.com/mattn/go-isatty v0.0.20 // indirect
102100
github.com/mattn/go-runewidth v0.0.16 // indirect
103101
github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b // indirect
104-
github.com/miekg/pkcs11 v1.1.1 // indirect
105102
github.com/mitchellh/hashstructure/v2 v2.0.2 // indirect
106-
github.com/mitchellh/mapstructure v1.5.0 // indirect
107103
github.com/moby/docker-image-spec v1.3.1 // indirect
108104
github.com/moby/locker v1.0.1 // indirect
109105
github.com/moby/sys/capability v0.4.0 // indirect
@@ -112,22 +108,16 @@ require (
112108
github.com/moby/sys/symlink v0.3.0 // indirect
113109
github.com/moby/sys/user v0.4.0 // indirect
114110
github.com/moby/sys/userns v0.1.0 // indirect
115-
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
116111
github.com/otiai10/mint v1.6.3 // indirect
117112
github.com/pelletier/go-toml v1.9.5 // indirect
118113
github.com/pkg/errors v0.9.1 // indirect
119114
github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10 // indirect
120115
github.com/pmezard/go-difflib v1.0.0 // indirect
121-
github.com/prometheus/client_golang v1.23.2 // indirect
122-
github.com/prometheus/client_model v0.6.2 // indirect
123-
github.com/prometheus/common v0.66.1 // indirect
124-
github.com/prometheus/procfs v0.16.1 // indirect
125116
github.com/rivo/uniseg v0.2.0 // indirect
126117
github.com/russross/blackfriday/v2 v2.1.0 // indirect
127118
github.com/santhosh-tekuri/jsonschema/v6 v6.0.1 // indirect
128119
github.com/secure-systems-lab/go-securesystemslib v0.9.1 // indirect
129120
github.com/shibumi/go-pathspec v1.3.0 // indirect
130-
github.com/theupdateframework/notary v0.7.0 // indirect
131121
github.com/tonistiigi/dchapes-mode v0.0.0-20250318174251-73d941a28323 // indirect
132122
github.com/tonistiigi/fsutil v0.0.0-20250605211040-586307ad452f // indirect
133123
github.com/tonistiigi/go-csvvalue v0.0.0-20240814133006-030d3b2625d0 // indirect
@@ -142,7 +132,6 @@ require (
142132
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.38.0 // indirect
143133
go.opentelemetry.io/otel/sdk/metric v1.38.0 // indirect
144134
go.opentelemetry.io/proto/otlp v1.7.1 // indirect
145-
go.yaml.in/yaml/v2 v2.4.2 // indirect
146135
go.yaml.in/yaml/v3 v3.0.4 // indirect
147136
golang.org/x/crypto v0.42.0 // indirect
148137
golang.org/x/net v0.44.0 // indirect

0 commit comments

Comments
 (0)