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
This PR adds Docker socket integration to Newt, enabling remote inspection of Docker containers. This functionality allows Pangolin to query and retrieve information about Docker containers running on the Newt client side.
✨ What's New
Docker Socket Detection: Added ability to check if Docker socket is available at a specified path
Container Listing: Implemented comprehensive Docker container information retrieval including:
INFO: 2025/05/29 22:56:06 Received Docker socket check request
DEBUG: 2025/05/29 22:56:06 Docker socket is available at /var/run/docker.sock
INFO: 2025/05/29 22:56:06 Docker socket check response sent: available=true
INFO: 2025/05/29 22:56:09 Received Docker container fetch request
INFO: 2025/05/29 22:56:09 Docker container list sent, count: 7
🔄 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/46
**Author:** [@improbableone](https://github.com/improbableone)
**Created:** 5/29/2025
**Status:** ✅ Merged
**Merged:** 6/3/2025
**Merged by:** [@oschwartz10612](https://github.com/oschwartz10612)
**Base:** `dev` ← **Head:** `hub-dev`
---
### 📝 Commits (2)
- [`4cf83f4`](https://github.com/fosrl/newt/commit/4cf83f4cfc40814ba0c945b542835c38696c818e) docker socket
- [`9f006b1`](https://github.com/fosrl/newt/commit/9f006b1cbda89ba48badfe73d4d65ae3fb605a78) Update packages
### 📊 Changes
**4 files changed** (+226 additions, -13 deletions)
<details>
<summary>View changed files</summary>
➕ `docker/client.go` (+166 -0)
📝 `go.mod` (+3 -3)
📝 `go.sum` (+6 -6)
📝 `main.go` (+51 -4)
</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
This PR adds Docker socket integration to Newt, enabling remote inspection of Docker containers. This functionality allows Pangolin to query and retrieve information about Docker containers running on the Newt client side.
### ✨ What's New
- **Docker Socket Detection**: Added ability to check if Docker socket is available at a specified path
- **Container Listing**: Implemented comprehensive Docker container information retrieval including:
- Container metadata (ID, name, image, state, status)
- Port mappings and network configurations
- Labels and creation timestamps
- Detailed network information (IP addresses, gateways, DNS names, etc.)
### 🔧 Technical Changes
#### New Files
- Docker client implementation with:
- `CheckSocket()` function to verify Docker socket availability
- `ListContainers()` function to retrieve comprehensive container information
- Structured types for `Container`, `Port`, and `Network` data
#### Modified Files
- **main.go**:
- Added Docker socket path configuration via `DOCKER_SOCKET` environment variable
- Implemented WebSocket handlers for `newt/socket/check` and `newt/socket/fetch` commands
- Integrated Docker functionality into the main event loop
- **go.mod**: Added Docker SDK dependencies:
- `github.com/docker/docker` - Official Docker SDK for Go
- Related dependencies for OpenTelemetry, HTTP connections, and container specifications
### 🔌 WebSocket API
Two new WebSocket message handlers:
1. **`newt/socket/check`**: Responds with Docker socket availability status
2. **`newt/socket/fetch`**: Returns detailed list of all Docker containers with full network information
### 🛠️ Configuration
- **Environment Variable**: `DOCKER_SOCKET` (defaults to docker.sock)
- Graceful fallback when Docker socket is not available
- Timeout protection for Docker API calls (5-second timeout)
- Non-blocking Docker operations that don't affect core Newt functionality
### 🎯 Use Cases
This enhancement enables Pangolin to:
- Monitor Docker containers across remote Newt installations
- Provide centralized container visibility and management
- Support container-aware routing and proxy configurations
- Enable future container orchestration features
## How to test?
- Start pangolin from the corresponding [PR](https://github.com/fosrl/pangolin/pull/802)
- Build newt and register it with pangolin
```shell
INFO: 2025/05/29 22:56:06 Received Docker socket check request
DEBUG: 2025/05/29 22:56:06 Docker socket is available at /var/run/docker.sock
INFO: 2025/05/29 22:56:06 Docker socket check response sent: available=true
INFO: 2025/05/29 22:56:09 Received Docker container fetch request
INFO: 2025/05/29 22:56:09 Docker container list sent, count: 7
```
---
<sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
📋 Pull Request Information
Original PR: https://github.com/fosrl/newt/pull/46
Author: @improbableone
Created: 5/29/2025
Status: ✅ Merged
Merged: 6/3/2025
Merged by: @oschwartz10612
Base:
dev← Head:hub-dev📝 Commits (2)
4cf83f4docker socket9f006b1Update packages📊 Changes
4 files changed (+226 additions, -13 deletions)
View changed files
➕
docker/client.go(+166 -0)📝
go.mod(+3 -3)📝
go.sum(+6 -6)📝
main.go(+51 -4)📄 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
This PR adds Docker socket integration to Newt, enabling remote inspection of Docker containers. This functionality allows Pangolin to query and retrieve information about Docker containers running on the Newt client side.
✨ What's New
🔧 Technical Changes
New Files
CheckSocket()function to verify Docker socket availabilityListContainers()function to retrieve comprehensive container informationContainer,Port, andNetworkdataModified Files
main.go:
DOCKER_SOCKETenvironment variablenewt/socket/checkandnewt/socket/fetchcommandsgo.mod: Added Docker SDK dependencies:
github.com/docker/docker- Official Docker SDK for Go🔌 WebSocket API
Two new WebSocket message handlers:
newt/socket/check: Responds with Docker socket availability statusnewt/socket/fetch: Returns detailed list of all Docker containers with full network information🛠️ Configuration
DOCKER_SOCKET(defaults to docker.sock)🎯 Use Cases
This enhancement enables Pangolin to:
How to test?
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.