[PR #14] [MERGED] Broaden Docker API surface for Portainer #15

Closed
opened 2026-10-15 12:51:18 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/games-on-whales/LXC2Docker/pull/14
Author: @JBailes
Created: 4/18/2026
Status: ✅ Merged
Merged: 4/18/2026
Merged by: @JBailes

Base: docker-lxc-daemon ← Head: aimee/session/0ec78fd2-portainer


📝 Commits (10+)

  • 216c0dd Broaden Docker API surface for Portainer compatibility
  • daeb2e7 Round-trip full create payload and add filter support for Portainer
  • d7c5c8c Wire privileged/capabilities, refine logs, add event filters
  • 22c861b Streaming pulls, registry auth, restart watcher, image labels
  • c0ed74c Wire ExtraHosts/Sysctls/Tmpfs, exec resize, live limits, image events
  • 3ef49f6 Named volumes, healthcheck runner, FinishedAt, blkio stats
  • 6f3dd8e Populate /system/df, wire NanoCpus, log rotation, health polish
  • 9024da2 Exec env inheritance, CPU throttle stats, rotated log tail
  • 1a12cb0 Anon volumes, name conflicts, stop timeout, digests, v1 blkio
  • 6a0edac RFC3339 timestamps, container size, exec User, stop signal, 304

📊 Changes

15 files changed (+5664 additions, -3868 deletions)

View changed files

📝 cmd/docker-lxc-daemon/main.go (+5 -1)
📝 internal/api/containers.go (+1320 -1196)
📝 internal/api/events.go (+350 -23)
📝 internal/api/exec.go (+93 -157)
➕ internal/api/filters.go (+159 -0)
📝 internal/api/images.go (+308 -476)
➕ internal/api/portainer.go (+380 -0)
📝 internal/api/router.go (+96 -65)
➕ internal/api/stats.go (+649 -0)
📝 internal/api/system.go (+645 -490)
📝 internal/api/types.go (+321 -481)
📝 internal/lxc/config.go (+254 -5)
📝 internal/lxc/manager.go (+711 -603)
📝 internal/oci/pull.go (+223 -67)
📝 internal/store/store.go (+150 -304)

📄 Description

Summary

  • Adds the Docker Engine API endpoints Portainer (and similar web UIs) probe beyond the raw CLI's needs: /system/df, /volumes/*, /containers/{id}/stats, pause/unpause, /events broker, prune endpoints, /auth, /images/{name}/history.
  • Fleshes out /_ping headers and /info fields so Portainer's engine panel recognizes the daemon as healthy.
  • /events now emits real lifecycle events (create/start/stop/die/restart/pause/unpause/destroy/rename) instead of blocking forever, so Portainer's live dashboard updates as containers change state.
  • Real CPU/memory/network stats sourced from /proc and cgroup v1/v2; one-shot (?stream=0) and streaming modes supported.
  • /networks list now returns the actual gow bridge plus host/none so the Networks tab renders with real data.
  • ContainerJSON/ContainerSummary gain fields Portainer reads (Path, Args, Driver, Platform, GraphDriver, Ports, full NetworkSettings with EndpointID, mounts on the list view).
  • Pause/unpause wired to lxc-freeze / pct suspend; State() maps LXC FROZEN -> Docker paused.

Why

The daemon is marketed as a drop-in /var/run/docker.sock, but its previous surface only covered what the CLI and compose hit. Anyone pointing Portainer at the socket saw: volumes tab broken (404), live updates never arriving (events stub blocked), dashboard stats showing "—", pause button 404ing. This PR unblocks Portainer without changing the daemon's container model.

Test plan

  • make build passes on liblxc-dev hosts
  • go vet ./... clean
  • Point Portainer at the socket and confirm: dashboard loads, container list shows IPs, stats graphs render, events stream on start/stop, pause/unpause buttons succeed, Volumes tab no longer errors
  • Run existing Wolf + compose flows to verify no regression (the Docker CLI/compose paths are unchanged)
  • docker stats <name> --no-stream returns populated CPU/memory/network numbers
  • docker events prints real lines on container lifecycle actions

🔄 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/games-on-whales/LXC2Docker/pull/14 **Author:** [@JBailes](https://github.com/JBailes) **Created:** 4/18/2026 **Status:** ✅ Merged **Merged:** 4/18/2026 **Merged by:** [@JBailes](https://github.com/JBailes) **Base:** `docker-lxc-daemon` ← **Head:** `aimee/session/0ec78fd2-portainer` --- ### 📝 Commits (10+) - [`216c0dd`](https://github.com/games-on-whales/LXC2Docker/commit/216c0dd570cf78dc0a6736c2f914ae370e92cee9) Broaden Docker API surface for Portainer compatibility - [`daeb2e7`](https://github.com/games-on-whales/LXC2Docker/commit/daeb2e7eb1ef3686573164152f03598eda43754f) Round-trip full create payload and add filter support for Portainer - [`d7c5c8c`](https://github.com/games-on-whales/LXC2Docker/commit/d7c5c8c6b7fa1ee877b904fe2648c59571c9fbfe) Wire privileged/capabilities, refine logs, add event filters - [`22c861b`](https://github.com/games-on-whales/LXC2Docker/commit/22c861b8cc61324be9ca9a19b761c1c6dbb256c6) Streaming pulls, registry auth, restart watcher, image labels - [`c0ed74c`](https://github.com/games-on-whales/LXC2Docker/commit/c0ed74c7029eaf0430c7eae3f6ad84debf091cbb) Wire ExtraHosts/Sysctls/Tmpfs, exec resize, live limits, image events - [`3ef49f6`](https://github.com/games-on-whales/LXC2Docker/commit/3ef49f6ec909352d109ce89f4a1dabf64ff87f3c) Named volumes, healthcheck runner, FinishedAt, blkio stats - [`6f3dd8e`](https://github.com/games-on-whales/LXC2Docker/commit/6f3dd8e5623db2f15db03b6f5bf62c5c32525dd9) Populate /system/df, wire NanoCpus, log rotation, health polish - [`9024da2`](https://github.com/games-on-whales/LXC2Docker/commit/9024da2b5b511e70412639f683a5aebbcf34cc8e) Exec env inheritance, CPU throttle stats, rotated log tail - [`1a12cb0`](https://github.com/games-on-whales/LXC2Docker/commit/1a12cb0ea92a181dc3fd4bd22c7f3f842dc87b2b) Anon volumes, name conflicts, stop timeout, digests, v1 blkio - [`6a0edac`](https://github.com/games-on-whales/LXC2Docker/commit/6a0edace08808cdce6becac920ff3048dd0bd64b) RFC3339 timestamps, container size, exec User, stop signal, 304 ### 📊 Changes **15 files changed** (+5664 additions, -3868 deletions) <details> <summary>View changed files</summary> 📝 `cmd/docker-lxc-daemon/main.go` (+5 -1) 📝 `internal/api/containers.go` (+1320 -1196) 📝 `internal/api/events.go` (+350 -23) 📝 `internal/api/exec.go` (+93 -157) ➕ `internal/api/filters.go` (+159 -0) 📝 `internal/api/images.go` (+308 -476) ➕ `internal/api/portainer.go` (+380 -0) 📝 `internal/api/router.go` (+96 -65) ➕ `internal/api/stats.go` (+649 -0) 📝 `internal/api/system.go` (+645 -490) 📝 `internal/api/types.go` (+321 -481) 📝 `internal/lxc/config.go` (+254 -5) 📝 `internal/lxc/manager.go` (+711 -603) 📝 `internal/oci/pull.go` (+223 -67) 📝 `internal/store/store.go` (+150 -304) </details> ### 📄 Description ## Summary - Adds the Docker Engine API endpoints Portainer (and similar web UIs) probe beyond the raw CLI's needs: `/system/df`, `/volumes/*`, `/containers/{id}/stats`, pause/unpause, `/events` broker, prune endpoints, `/auth`, `/images/{name}/history`. - Fleshes out `/_ping` headers and `/info` fields so Portainer's engine panel recognizes the daemon as healthy. - `/events` now emits real lifecycle events (`create`/`start`/`stop`/`die`/`restart`/`pause`/`unpause`/`destroy`/`rename`) instead of blocking forever, so Portainer's live dashboard updates as containers change state. - Real CPU/memory/network stats sourced from `/proc` and cgroup v1/v2; one-shot (`?stream=0`) and streaming modes supported. - `/networks` list now returns the actual `gow` bridge plus `host`/`none` so the Networks tab renders with real data. - `ContainerJSON`/`ContainerSummary` gain fields Portainer reads (`Path`, `Args`, `Driver`, `Platform`, `GraphDriver`, `Ports`, full `NetworkSettings` with `EndpointID`, mounts on the list view). - Pause/unpause wired to `lxc-freeze` / `pct suspend`; `State()` maps LXC `FROZEN` -> Docker `paused`. ## Why The daemon is marketed as a drop-in `/var/run/docker.sock`, but its previous surface only covered what the CLI and compose hit. Anyone pointing Portainer at the socket saw: volumes tab broken (404), live updates never arriving (events stub blocked), dashboard stats showing "—", pause button 404ing. This PR unblocks Portainer without changing the daemon's container model. ## Test plan - [x] `make build` passes on liblxc-dev hosts - [x] `go vet ./...` clean - [ ] Point Portainer at the socket and confirm: dashboard loads, container list shows IPs, stats graphs render, events stream on start/stop, pause/unpause buttons succeed, Volumes tab no longer errors - [ ] Run existing Wolf + compose flows to verify no regression (the Docker CLI/compose paths are unchanged) - [ ] `docker stats <name> --no-stream` returns populated CPU/memory/network numbers - [ ] `docker events` prints real lines on container lifecycle actions --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-15 12:51:18 +00:00
Sign in to join this conversation.
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
games-on-whales/LXC2Docker#15
No description provided.