[PR #1] [MERGED] Docker API to LXC translation daemon #5

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

📋 Pull Request Information

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

Base: main ← Head: docker-lxc-daemon


📝 Commits (1)

  • d81c579 docker-lxc-daemon: Docker API to LXC translation daemon

📊 Changes

21 files changed (+3714 additions, -0 deletions)

View changed files

➕ .gitignore (+1 -0)
➕ Makefile (+39 -0)
➕ cmd/docker-lxc-daemon/main.go (+74 -0)
➕ go.mod (+10 -0)
➕ go.sum (+8 -0)
➕ internal/api/containers.go (+767 -0)
➕ internal/api/exec.go (+292 -0)
➕ internal/api/images.go (+102 -0)
➕ internal/api/router.go (+81 -0)
➕ internal/api/system.go (+104 -0)
➕ internal/api/types.go (+246 -0)
➕ internal/image/distro.go (+205 -0)
➕ internal/image/registry.go (+116 -0)
➕ internal/image/resolver.go (+146 -0)
➕ internal/lxc/config.go (+251 -0)
➕ internal/lxc/manager.go (+542 -0)
➕ internal/lxc/network.go (+144 -0)
➕ internal/lxc/syscall.go (+20 -0)
➕ internal/oci/pull.go (+214 -0)
➕ internal/store/store.go (+314 -0)

...and 1 more files

📄 Description

Summary

  • Go daemon that exposes a Docker-compatible Unix socket API backed by raw LXC containers (no Docker Engine, LXD, or Incus required)
  • Allows the standard docker CLI to manage LXC containers transparently — docker run, docker exec, docker ps, docker cp, port forwarding with -p, etc.
  • Targets the use case of replacing Docker entirely with LXC on Proxmox hosts

Architecture

Docker CLI → /var/run/docker.sock → docker-lxc-daemon → liblxc → LXC containers
  • Image resolution: Distro images via LXC download template, app images via base + package install, arbitrary OCI images via skopeo + umoci
  • Networking: Dedicated gow0 bridge (10.100.0.0/24) with nftables NAT + DNAT port forwarding
  • Config: Rewrites cloned LXC configs to disable AppArmor/userns for Proxmox compatibility
  • State: JSON file store tracks containers, images, IP pool; reconciles on daemon restart

Supported commands

Command Status
docker run -d [-p host:container] Working
docker ps / docker inspect Working
docker exec [-it] Working
docker logs [-f] Working
docker stop / start / restart / kill Working
docker rm [-f] Working
docker cp (both directions) Working
docker top / rename Working
docker pull (distro + app + OCI images) Working
docker images / rmi Working
docker version / info Working

Build & install

apt install lxc-dev
make deps && make build
sudo make install
sudo systemctl enable --now docker-lxc-daemon

Test plan

  • System endpoints (_ping, version, info)
  • Image pull — distro (ubuntu:22.04), app (nginx:latest), OCI (hello-world, httpd:2.4)
  • Container lifecycle (create, start, stop, restart, kill, rm, rm -f)
  • Exec — interactive TTY and non-TTY multiplexed
  • Port forwarding — localhost and external
  • DNS resolution inside containers
  • Docker cp — both directions, path traversal protection verified
  • State reconciliation after daemon restart
  • IP reclamation on container removal

Extracted from games-on-whales/gow#308


🔄 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/1 **Author:** [@JBailes](https://github.com/JBailes) **Created:** 4/12/2026 **Status:** ✅ Merged **Merged:** 4/14/2026 **Merged by:** [@JBailes](https://github.com/JBailes) **Base:** `main` ← **Head:** `docker-lxc-daemon` --- ### 📝 Commits (1) - [`d81c579`](https://github.com/games-on-whales/LXC2Docker/commit/d81c5793792c5c80a8a59b86b0963b927820003f) docker-lxc-daemon: Docker API to LXC translation daemon ### 📊 Changes **21 files changed** (+3714 additions, -0 deletions) <details> <summary>View changed files</summary> ➕ `.gitignore` (+1 -0) ➕ `Makefile` (+39 -0) ➕ `cmd/docker-lxc-daemon/main.go` (+74 -0) ➕ `go.mod` (+10 -0) ➕ `go.sum` (+8 -0) ➕ `internal/api/containers.go` (+767 -0) ➕ `internal/api/exec.go` (+292 -0) ➕ `internal/api/images.go` (+102 -0) ➕ `internal/api/router.go` (+81 -0) ➕ `internal/api/system.go` (+104 -0) ➕ `internal/api/types.go` (+246 -0) ➕ `internal/image/distro.go` (+205 -0) ➕ `internal/image/registry.go` (+116 -0) ➕ `internal/image/resolver.go` (+146 -0) ➕ `internal/lxc/config.go` (+251 -0) ➕ `internal/lxc/manager.go` (+542 -0) ➕ `internal/lxc/network.go` (+144 -0) ➕ `internal/lxc/syscall.go` (+20 -0) ➕ `internal/oci/pull.go` (+214 -0) ➕ `internal/store/store.go` (+314 -0) _...and 1 more files_ </details> ### 📄 Description ## Summary - Go daemon that exposes a Docker-compatible Unix socket API backed by raw LXC containers (no Docker Engine, LXD, or Incus required) - Allows the standard `docker` CLI to manage LXC containers transparently — `docker run`, `docker exec`, `docker ps`, `docker cp`, port forwarding with `-p`, etc. - Targets the use case of replacing Docker entirely with LXC on Proxmox hosts ## Architecture ``` Docker CLI → /var/run/docker.sock → docker-lxc-daemon → liblxc → LXC containers ``` - **Image resolution**: Distro images via LXC download template, app images via base + package install, arbitrary OCI images via skopeo + umoci - **Networking**: Dedicated `gow0` bridge (10.100.0.0/24) with nftables NAT + DNAT port forwarding - **Config**: Rewrites cloned LXC configs to disable AppArmor/userns for Proxmox compatibility - **State**: JSON file store tracks containers, images, IP pool; reconciles on daemon restart ## Supported commands | Command | Status | |---|---| | `docker run -d [-p host:container]` | Working | | `docker ps` / `docker inspect` | Working | | `docker exec [-it]` | Working | | `docker logs [-f]` | Working | | `docker stop` / `start` / `restart` / `kill` | Working | | `docker rm [-f]` | Working | | `docker cp` (both directions) | Working | | `docker top` / `rename` | Working | | `docker pull` (distro + app + OCI images) | Working | | `docker images` / `rmi` | Working | | `docker version` / `info` | Working | ## Build & install ```bash apt install lxc-dev make deps && make build sudo make install sudo systemctl enable --now docker-lxc-daemon ``` ## Test plan - [x] System endpoints (`_ping`, `version`, `info`) - [x] Image pull — distro (ubuntu:22.04), app (nginx:latest), OCI (hello-world, httpd:2.4) - [x] Container lifecycle (create, start, stop, restart, kill, rm, rm -f) - [x] Exec — interactive TTY and non-TTY multiplexed - [x] Port forwarding — localhost and external - [x] DNS resolution inside containers - [x] Docker cp — both directions, path traversal protection verified - [x] State reconciliation after daemon restart - [x] IP reclamation on container removal _Extracted from games-on-whales/gow#308_ --- <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:13 +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#5
No description provided.