[PR #349] [MERGED] Refactor Docker client imports and container handling logic #7430

Closed
opened 2026-06-20 14:55:09 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/fosrl/newt/pull/349
Author: @marcschaeferger
Created: 5/10/2026
Status: Merged
Merged: 5/17/2026
Merged by: @oschwartz10612

Base: mainHead: issue-348


📝 Commits (1)

  • 0e2d705 refactor: update Docker client imports and adjust container handling logic

📊 Changes

3 files changed (+56 additions, -75 deletions)

View changed files

📝 docker/docker.go (+31 -23)
📝 go.mod (+7 -14)
📝 go.sum (+18 -38)

📄 Description

Community Contribution License Agreement

By creating this pull request, I grant the project maintainers an unlimited,
perpetual license to use, modify, and redistribute these contributions under any terms they
choose, including both the AGPLv3 and the Fossorial Commercial license terms. I
represent that I have the right to grant this license for all contributed content.

Description (generated by Copilot)

This pull request migrates the Docker integration from the deprecated github.com/docker/docker package to the actively maintained github.com/moby/moby packages. It updates imports, adapts to new APIs, and adjusts code to work with the new types and structures, improving long-term maintainability and compatibility.

Migration to moby/moby Docker client:

  • Replaced all imports of github.com/docker/docker with github.com/moby/moby/api and github.com/moby/moby/client throughout docker/docker.go. [1] [2]
  • Updated code to use new types and methods from the moby/moby client, including changes to container listing, inspection, and event streaming logic. [1] [2] [3] [4] [5] [6]

Adaptation to new API structures:

  • Refactored code to handle new result structures (e.g., ContainerListResult.Items, ContainerInspectOptions, EventsListOptions), and updated field accesses accordingly. [1] [2] [3]
  • Added helper functions and conversions to accommodate new types for IP addresses, MAC addresses, and other fields, ensuring correct string formatting and validation. [1] [2] [3]

Dependency updates:

  • Removed the old github.com/docker/docker dependency and added github.com/moby/moby/api and github.com/moby/moby/client in go.mod.
  • Updated several indirect dependencies to newer versions for compatibility with the new Docker client.

Closes: #348


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/fosrl/newt/pull/349 **Author:** [@marcschaeferger](https://github.com/marcschaeferger) **Created:** 5/10/2026 **Status:** ✅ Merged **Merged:** 5/17/2026 **Merged by:** [@oschwartz10612](https://github.com/oschwartz10612) **Base:** `main` ← **Head:** `issue-348` --- ### 📝 Commits (1) - [`0e2d705`](https://github.com/fosrl/newt/commit/0e2d7057b6f61cfba92aed4b82ae41823fd3db50) refactor: update Docker client imports and adjust container handling logic ### 📊 Changes **3 files changed** (+56 additions, -75 deletions) <details> <summary>View changed files</summary> 📝 `docker/docker.go` (+31 -23) 📝 `go.mod` (+7 -14) 📝 `go.sum` (+18 -38) </details> ### 📄 Description ## Community Contribution License Agreement By creating this pull request, I grant the project maintainers an unlimited, perpetual license to use, modify, and redistribute these contributions under any terms they choose, including both the AGPLv3 and the Fossorial Commercial license terms. I represent that I have the right to grant this license for all contributed content. ## Description (generated by Copilot) This pull request migrates the Docker integration from the deprecated `github.com/docker/docker` package to the actively maintained `github.com/moby/moby` packages. It updates imports, adapts to new APIs, and adjusts code to work with the new types and structures, improving long-term maintainability and compatibility. **Migration to `moby/moby` Docker client:** * Replaced all imports of `github.com/docker/docker` with `github.com/moby/moby/api` and `github.com/moby/moby/client` throughout `docker/docker.go`. [[1]](diffhunk://#diff-3b425d7dadd18dc6d2fadc2bc169afae1f7bbc8f757a66d2837e9e78fb792c90L12-R14) [[2]](diffhunk://#diff-33ef32bf6c23acb95f5902d7097b7a1d5128ca061167ec0716715b0b9eeaa5f6L6-R9) * Updated code to use new types and methods from the `moby/moby` client, including changes to container listing, inspection, and event streaming logic. [[1]](diffhunk://#diff-3b425d7dadd18dc6d2fadc2bc169afae1f7bbc8f757a66d2837e9e78fb792c90L173-R172) [[2]](diffhunk://#diff-3b425d7dadd18dc6d2fadc2bc169afae1f7bbc8f757a66d2837e9e78fb792c90L218-R238) [[3]](diffhunk://#diff-3b425d7dadd18dc6d2fadc2bc169afae1f7bbc8f757a66d2837e9e78fb792c90L318-R329) [[4]](diffhunk://#diff-3b425d7dadd18dc6d2fadc2bc169afae1f7bbc8f757a66d2837e9e78fb792c90L374-R380) [[5]](diffhunk://#diff-3b425d7dadd18dc6d2fadc2bc169afae1f7bbc8f757a66d2837e9e78fb792c90L385-R394) [[6]](diffhunk://#diff-3b425d7dadd18dc6d2fadc2bc169afae1f7bbc8f757a66d2837e9e78fb792c90L411-R421) **Adaptation to new API structures:** * Refactored code to handle new result structures (e.g., `ContainerListResult.Items`, `ContainerInspectOptions`, `EventsListOptions`), and updated field accesses accordingly. [[1]](diffhunk://#diff-3b425d7dadd18dc6d2fadc2bc169afae1f7bbc8f757a66d2837e9e78fb792c90L218-R238) [[2]](diffhunk://#diff-3b425d7dadd18dc6d2fadc2bc169afae1f7bbc8f757a66d2837e9e78fb792c90L318-R329) [[3]](diffhunk://#diff-3b425d7dadd18dc6d2fadc2bc169afae1f7bbc8f757a66d2837e9e78fb792c90L385-R394) * Added helper functions and conversions to accommodate new types for IP addresses, MAC addresses, and other fields, ensuring correct string formatting and validation. [[1]](diffhunk://#diff-3b425d7dadd18dc6d2fadc2bc169afae1f7bbc8f757a66d2837e9e78fb792c90L256-R263) [[2]](diffhunk://#diff-3b425d7dadd18dc6d2fadc2bc169afae1f7bbc8f757a66d2837e9e78fb792c90L271-R289) [[3]](diffhunk://#diff-3b425d7dadd18dc6d2fadc2bc169afae1f7bbc8f757a66d2837e9e78fb792c90L294-R300) **Dependency updates:** * Removed the old `github.com/docker/docker` dependency and added `github.com/moby/moby/api` and `github.com/moby/moby/client` in `go.mod`. * Updated several indirect dependencies to newer versions for compatibility with the new Docker client. Closes: #348 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-06-20 14:55:09 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/newt#7430