Skip to content

migrate to moby modules - #13078

Merged
ndeloof merged 5 commits into
docker:mainfrom
thaJeztah:bump_moby_cli
Feb 11, 2026
Merged

migrate to moby modules#13078
ndeloof merged 5 commits into
docker:mainfrom
thaJeztah:bump_moby_cli

Conversation

@thaJeztah

@thaJeztahthaJeztah commented Jul 21, 2025

Copy link
Copy Markdown
Member

@thaJeztah
thaJeztah requested a review from a team as a code ownerJuly 21, 2025 18:51
@thaJeztah
thaJeztah requested review from glours and ndeloofJuly 21, 2025 18:51
@thaJeztah
thaJeztah marked this pull request as draft July 21, 2025 18:51
@thaJeztahthaJeztah changed the title Bump moby cliWIP: migrate to moby modulesJul 21, 2025
@thaJeztah
thaJeztahforce-pushed the bump_moby_cli branch 2 times, most recently from a5b199b to 73bb946CompareJuly 21, 2025 18:55
@ndeloof

Copy link
Copy Markdown
Contributor

Nice to see moby API as a dedicated module, so we don't get transitive dependencies from engine inside Compose ! ❤️

Comment threadcmd/compose/bridge.go Outdated
@@ -0,0 +1,89 @@
// Package urlutil provides helper function to check if a given build-context

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added this fork temporarily; didn't realise compose itself also uses it (not only through cli); the CLI fork is "internal", so probably needs to made public, or we keep a fork here 😞

@thaJeztah

Copy link
Copy Markdown
MemberAuthor

Remaining uses of docker/docker;

tree -d vendor/github.com/docker/docker
vendor/github.com/docker/docker
├── internal
│ └── lazyregexp
├── pkg
│ ├── jsonmessage
│ ├── namesgenerator
│ ├── pidfile
│ ├── process
│ ├── progress
│ ├── stdcopy
│ ├── streamformatter
│ └── stringid
└── registry
13 directories

@thaJeztah

Copy link
Copy Markdown
MemberAuthor

Build failure looks like it may be an incompatible change in buildx itself?

 > [build 1/1] RUN --mount=type=bind,target=. --mount=type=cache,target=/root/.cache --mount=type=cache,target=/go/pkg/mod --mount=type=bind,from=osxcross,src=/osxsdk,target=/xx-sdk xx-go --wrap && if [ "$(xx-info os)" == "darwin" ]; then export CGO_ENABLED=1; fi && make build GO_BUILDTAGS="e2e" DESTDIR=/out && xx-verify --static /out/docker-compose:
1.027 GO111MODULE=on go build -trimpath -tags "e2e" -ldflags "-w -X github.com/docker/compose/v2/internal.Version=fa50b46" -o "/out/docker-compose" ./cmd
38.90 # github.com/docker/buildx/build
38.90 /go/pkg/mod/github.com/tha!jeztah/buildx@v0.2.1-0.20250721183044-80b40a761230/build/provenance.go:135:16: pred1.ConvertToSLSA02 undefined (type *"github.com/moby/buildkit/solver/llbsolver/provenance/types".ProvenancePredicateSLSA1 has no field or method ConvertToSLSA02)
67.83 make: *** [Makefile:61: build] Error 1
38.90 /go/pkg/mod/github.com/tha!jeztah/buildx@v0.2.1-0.20250721183044-80b40a761230/build/provenance.go:135:16: pred1.ConvertToSLSA02 undefined (type 

@thaJeztah

Copy link
Copy Markdown
MemberAuthor

OK, it's because buildx depends on an unreleased version of BuildKit, so go modules considers it to be older than the latest release and won't update; https://github.com/docker/buildx/blob/3f4bf829d8c5b92a8f670609417d9aa4c0b6be98/go.mod#L32

github.com/moby/buildkit v0.23.0-rc1.0.20250618182037-9b91d20367db // master

@thaJeztah
thaJeztahforce-pushed the bump_moby_cli branch 2 times, most recently from 83ca48f to 13827c4CompareJuly 21, 2025 19:20
@ndeloof

Copy link
Copy Markdown
Contributor
  • jsonmessage
    this one should be part of the API, don't you think ?

@thaJeztah

Copy link
Copy Markdown
MemberAuthor

Yes, or at least the type; the utilities could be "client" - those packages are messy.

Also looking at things that are in the api, but shouldn't (api/types/plugins/logdriver)

@thaJeztah

Copy link
Copy Markdown
MemberAuthor

Also included a (WIP) branch for docker/cli#6202

Before/After;

Details

Before:

tree -d vendor/github.com/docker/cli
vendor/github.com/docker/cli
├── cli
│ ├── command
│ │ ├── completion
│ │ ├── container
│ │ ├── formatter
│ │ │ └── tabwriter
│ │ ├── image
│ │ │ └── build
│ │ │ └── internal
│ │ │ ├── git
│ │ │ └── urlutil
│ │ └── inspect
│ ├── compose
│ │ ├── interpolation
│ │ ├── loader
│ │ ├── schema
│ │ │ └── data
│ │ ├── template
│ │ └── types
│ ├── config
│ │ ├── configfile
│ │ ├── credentials
│ │ ├── memorystore
│ │ └── types
│ ├── connhelper
│ │ ├── commandconn
│ │ ├── internal
│ │ │ └── syntax
│ │ └── ssh
│ ├── context
│ │ ├── docker
│ │ └── store
│ ├── debug
│ ├── flags
│ ├── hints
│ ├── streams
│ ├── trust
│ └── version
├── cli-plugins
│ ├── hooks
│ ├── manager
│ ├── metadata
│ ├── plugin
│ └── socket
├── internal
│ ├── jsonstream
│ ├── lazyregexp
│ ├── prompt
│ └── tui
├── opts
│ └── swarmopts
├── pkg
│ └── kvfile
└── templates
55 directories

After:

tree -d vendor/github.com/docker/cli
vendor/github.com/docker/cli
├── cli
│ ├── command
│ │ ├── completion
│ │ ├── container
│ │ ├── formatter
│ │ │ └── tabwriter
│ │ ├── image
│ │ │ └── build
│ │ │ └── internal
│ │ │ ├── git
│ │ │ └── urlutil
│ │ └── inspect
│ ├── config
│ │ ├── configfile
│ │ ├── credentials
│ │ ├── memorystore
│ │ └── types
│ ├── connhelper
│ │ ├── commandconn
│ │ ├── internal
│ │ │ └── syntax
│ │ └── ssh
│ ├── context
│ │ ├── docker
│ │ └── store
│ ├── debug
│ ├── flags
│ ├── hints
│ ├── streams
│ ├── trust
│ └── version
├── cli-plugins
│ ├── hooks
│ ├── manager
│ ├── metadata
│ ├── plugin
│ └── socket
├── internal
│ ├── jsonstream
│ ├── lazyregexp
│ ├── prompt
│ ├── tui
│ └── volumespec
├── opts
├── pkg
│ └── kvfile
└── templates
48 directories

@thaJeztah
thaJeztahforce-pushed the bump_moby_cli branch 3 times, most recently from d2146d4 to 3a7124dCompareJuly 24, 2025 09:24
@thaJeztah
thaJeztahforce-pushed the bump_moby_cli branch 3 times, most recently from 3b1ec4c to 6cd56afCompareAugust 5, 2025 22:51
@thaJeztah

Copy link
Copy Markdown
MemberAuthor

Down to two packages; both possibly candidates for github.com/moby/sys;

tree -d vendor/github.com/docker/docker
vendor/github.com/docker/docker
└── pkg
├── pidfile
└── process
4 directories

CLI still needs sorting out;

Details
tree -d vendor/github.com/docker/cli
vendor/github.com/docker/cli
├── cli
│ ├── command
│ │ ├── completion
│ │ ├── container
│ │ ├── formatter
│ │ │ └── tabwriter
│ │ ├── image
│ │ │ └── build
│ │ │ └── internal
│ │ │ ├── git
│ │ │ └── urlutil
│ │ ├── inspect
│ │ └── system
│ │ └── pruner
│ ├── config
│ │ ├── configfile
│ │ ├── credentials
│ │ ├── memorystore
│ │ └── types
│ ├── connhelper
│ │ ├── commandconn
│ │ ├── internal
│ │ │ └── syntax
│ │ └── ssh
│ ├── context
│ │ ├── docker
│ │ └── store
│ ├── debug
│ ├── flags
│ ├── hints
│ ├── streams
│ ├── trust
│ └── version
├── cli-plugins
│ ├── hooks
│ ├── manager
│ ├── metadata
│ ├── plugin
│ └── socket
├── internal
│ ├── jsonstream
│ ├── lazyregexp
│ ├── prompt
│ ├── registry
│ ├── tui
│ └── volumespec
├── opts
├── pkg
│ └── kvfile
└── templates
51 directories

@thaJeztah
thaJeztahforce-pushed the bump_moby_cli branch 2 times, most recently from d7c329f to 04ac165CompareAugust 28, 2025 21:12
@thaJeztah
thaJeztahforce-pushed the bump_moby_cli branch 7 times, most recently from a051b5a to 5098065CompareNovember 11, 2025 00:08
@thaJeztah
thaJeztahforce-pushed the bump_moby_cli branch 2 times, most recently from 70efab9 to 05f29edCompareNovember 16, 2025 14:11
@thaJeztahthaJeztah changed the title WIP: migrate to moby modulesmigrate to moby modulesNov 16, 2025
Comment on lines -426 to -429
// filter out useless commandConn.CloseWrite warning message that can occur
// when using a remote context that is unreachable: "commandConn.CloseWrite: commandconn: failed to wait: signal: killed"
// https://github.com/docker/cli/blob/e1f24d3c93df6752d3c27c8d61d18260f141310c/cli/connhelper/commandconn/commandconn.go#L203-L215
logrus.AddHook(logutil.NewFilter([]logrus.Level{

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These were removed in docker/cli#6644

Comment threadpkg/compose/push.go Outdated
Comment threadpkg/compose/pull.go Outdated
@codecov

codecovBot commented Jan 26, 2026

Copy link
Copy Markdown

Comment threadpkg/compose/create_test.go
Comment threadgo.mod Outdated
@@ -18,7 +18,6 @@ require (
github.com/docker/cli v29.2.0+incompatible

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh! Thought I had updated to v29.2.1; let me do so as well (no significant changes I think though)

thaJeztahand others added 5 commits February 10, 2026 16:51
Also update TestDefaultNetworkSettings:
Test that the network with the highest priority is returned as
"primary" network, and other networks as extra networks.
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Format layer progress details with minimal efforts as new UI
does not render individual layers
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Format layer progress details with minimal efforts as new UI does
not render individual layers.
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>

@gloursglours left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good to me, just 2 points we need to check

Comment threadpkg/compose/watch.go
func (s *composeService) pruneDanglingImagesOnRebuild(ctx context.Context, projectName string, imageNameToIdMap map[string]string) {
images, err := s.apiClient().ImageList(ctx, image.ListOptions{
Filters: filters.NewArgs(
filters.Arg("dangling", "true"),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We lost the projectLabel filter, no?

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let me check!

@thaJeztahthaJeztahFeb 10, 2026

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, right, so it now uses projectFilter;

images, err:=s.apiClient().ImageList(ctx, client.ImageListOptions{
Filters: projectFilter(projectName).Add("dangling", "true"),
})

which should add it;

funcprojectFilter(projectNamestring) client.Filters {
returnmake(client.Filters).Add("label", fmt.Sprintf("%s=%s", api.ProjectLabel, projectName))
}

Comment threadpkg/compose/watch.go
containers, err := s.apiClient().ContainerList(ctx, container.ListOptions{
All: true,
Filters: filters.NewArgs(
filters.Arg("label", fmt.Sprintf("%s=%s", api.ProjectLabel, project.Name)),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here?

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here as well, so I think we should be good 🫶

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@thaJeztah@ndeloof@glours@vvoland