feat(api): add GetContainer endpoint for Docker container retrieval

- Implemented GetContainer function to retrieve container details by ID.
- Added error handling for missing ID, container not found, and client creation failures.
- Enhanced Container struct to support omitempty for state field in JSON responses.
- Updated API documentation with Swagger annotations for the new endpoint.
This commit is contained in:
yusing
2025-09-14 00:12:23 +08:00
parent f3913e1f6f
commit 7b028adaa9
2 changed files with 64 additions and 1 deletions

View File

@@ -16,7 +16,7 @@ type Container struct {
Name string `json:"name"`
ID string `json:"id"`
Image string `json:"image"`
State ContainerState `json:"state"`
State ContainerState `json:"state,omitempty" extensions:"x-nullable"`
} // @name ContainerResponse
// @x-id "containers"