-
-
Notifications
You must be signed in to change notification settings - Fork 78
refactor: use moby/moby/client #753
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This pull request successfully refactors the codebase to use the new moby/moby/client and moby/moby/api modules instead of the legacy docker/docker module. The goal is to reduce binary size by using the modularized Moby packages.
Key Changes
- Client initialization: Updated from
client.NewClientWithOpts()toclient.New()across Docker and Docker Swarm providers - API method signatures: Adapted to new API patterns including return value changes (e.g.,
ContainerStop,ContainerStartnow return results) and options structures (e.g.,client.ServiceUpdateOptionsnow wrapsVersionandSpec) - Data structure access: Updated to use new collection wrappers (e.g.,
services.Itemsinstead of direct slice access,spec.Container.Stateinstead ofspec.State) - Filters API: Migrated from
filters.NewArgs()toclient.Filters{}with the sameAdd()method pattern - Events API: Transitioned from dual-channel pattern to result object pattern (
result.Messagesandresult.Errinstead of separate channels)
Reviewed changes
Copilot reviewed 24 out of 25 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| pkg/testcontainers/pind/pind.go | Removed Docker-specific imports; critical container configuration commented out |
| pkg/sabliercmd/provider.go | Updated client initialization to use client.New() instead of client.NewClientWithOpts() |
| pkg/provider/dockerswarm/*.go | Updated imports, filters API, service list/inspect methods to use new collection wrappers, ServiceUpdate options structure |
| pkg/provider/docker/*.go | Updated imports, container methods to handle new return values, events pattern, inspect response structure |
| go.mod | Added moby/moby/api and moby/moby/client dependencies; moved docker/docker to indirect dependency |
| go.sum | Updated dependency checksums for new modules |
| Makefile | Added .PHONY: build directive for make target |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.
| /*ConfigModifier: func(config *container.Config) { | ||
| // config.User = "podman" | ||
| }, | ||
| HostConfigModifier: func(hc *container.HostConfig) { | ||
| hc.Privileged = true | ||
| // Disable cgroup v2 for the container | ||
| hc.CgroupnsMode = "host" | ||
| hc.SecurityOpt = []string{"label=disable", "seccomp=unconfined", "apparmor=unconfined"} | ||
| }, | ||
| },*/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The ConfigModifier and HostConfigModifier functions have been commented out, which removes important container configuration. These modifiers were setting:
Privileged = true- Required for running Podman inside DockerCgroupnsMode = "host"- Disabling cgroup v2 for the containerSecurityOpt- Security options for label, seccomp, and apparmor
Commenting out this configuration will likely cause the Podman in Docker container to fail at runtime. These settings should be preserved unless there's a specific reason to remove them (e.g., if the new moby/moby/client API provides an alternative way to set these).
| "github.com/testcontainers/testcontainers-go/wait" 8000 | ||
|
|
||
| "github.com/testcontainers/testcontainers-go" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] The import statement for github.com/testcontainers/testcontainers-go/wait should be placed with other third-party imports after standard library imports, maintaining alphabetical order. Currently it's placed separately after the blank line, which breaks the import grouping convention.
| "github.com/testcontainers/testcontainers-go/wait" | |
| "github.com/testcontainers/testcontainers-go" | |
| "github.com/testcontainers/testcontainers-go" | |
| "github.com/testcontainers/testcontainers-go/wait" |
❌ 8 Tests Failed:
View the top 3 failed tests by shortest run time
📣 Thoughts on this report? Let Codecov know! | Powered by Codecov |
❌ 8 Tests Failed:
View the top 3 failed test(s) by shortest run time
View the full list of 1 ❄️ flaky test(s)
To view more test analytics, go to the Test Analytics Dashboard |
|


This should reduce the size of the binary by using the new
moby/moby/clientandmoby/moby/apimodules.testcontainers-go is still using the
docker/dockermodule, waiting for: testcontainers/testcontainers-go#3496