Skip to content

Update Docker dependencies#4957

Open
SuperQ wants to merge 2 commits into
aws:devfrom
SuperQ:superq/moby
Open

Update Docker dependencies#4957
SuperQ wants to merge 2 commits into
aws:devfrom
SuperQ:superq/moby

Conversation

@SuperQ
Copy link
Copy Markdown

@SuperQ SuperQ commented May 12, 2026

Summary

Replace the deprecated github.com/docker/docker Go modules with the new github.com/moby/moby/api.

Use github.com/prometheus/procfs to read /proc/meminfo so we don't have to pull in the whole github.com/moby/moby repo.

Implementation details

Testing

New tests cover the changes:

Description for the changelog

Additional Information

Does this PR include breaking model changes? If so, Have you added transformation functions?

Does this PR include the addition of new environment variables in the README?

Licensing

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

Comment thread ecs-agent/api/ecs/client/ecs_client.go Outdated
memInfo, err := meminfo.Read()
mem := int32(0)
fs, err := procfs.NewFS("/proc")
if err == nil {
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.

Suggested change
if err == nil {
if err != nil {

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.

And it needs some kind of early return, right?

Copy link
Copy Markdown
Contributor

@isker isker May 21, 2026

Choose a reason for hiding this comment

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

Also, it looks like (thanks to the vendor/ diff 😬) that the old docker dependency supported Windows, and this new prom one might not. I have absolutely no clue personally about Windows, other than I know ECS notionally supports it. There are certainly files in this repo that target Windows.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Hmm, Interesting, I didn't think about Windows compatibility because I thought all container support on Windows was done via WSL / Linux VMs. So procfs would be there.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

How do you feel about manually vendoring in the pkg/meminfo from moby? The code is simple, the license is compatible. This would avoid having to pull in all of the upstream moby go.mod dependencies just to pick up one package.

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.

Changes LGTM now. Of course the vendoring bit is up to the maintainers.

Replace the deprecated `github.com/docker/docker` Go modules with the
new `github.com/moby/moby/api`.

Use `github.com/prometheus/procfs` to read `/proc/meminfo` so we don't
have to pull in the whole `github.com/moby/moby` repo.

Signed-off-by: SuperQ <superq@gmail.com>
@SuperQ SuperQ requested a review from isker May 22, 2026 07:14
@mye956
Copy link
Copy Markdown
Contributor

mye956 commented May 22, 2026

Thanks for contributing @SuperQ! Could you switch the destination branch to point to dev instead?

@SuperQ SuperQ changed the base branch from master to dev May 23, 2026 06:21
@SuperQ
Copy link
Copy Markdown
Author

SuperQ commented May 23, 2026

Done, now dev.

Comment thread ecs-agent/api/ecs/client/ecs_client.go
// StatsResponse is the v4 Stats response for a container.
type StatsResponse struct {
*types.StatsJSON
*container.StatsResponse
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.

Since we're going from types.StatsJSON to container.StatsResponse, let's also make similar changes in agent/handlers/v4/ (this may cascade to a few other files that needs to be updated as well)

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Oof, I just looked through the agent directory, it has an absolute ton of github.com/docker/docker use.

Much regret.

Signed-off-by: SuperQ <superq@gmail.com>
Sign up for free to 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.

3 participants