mirror of
https://github.com/games-on-whales/LXC2Docker.git
synced 2026-10-16 05:12:04 +00:00
[PR #68] [MERGED] feat(containers): bind /etc/hostname from a container-id path so apps can self-identify #69
Labels
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
games-on-whales/LXC2Docker#69
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/games-on-whales/LXC2Docker/pull/68
Author: @JBailes
Created: 6/7/2026
Status: ✅ Merged
Merged: 6/7/2026
Merged by: @JBailes
Base:
main← Head:fix/container-id-hostname-bind📝 Commits (1)
f726940feat(containers): bind /etc/hostname from a container-id path so apps can self-identify📊 Changes
3 files changed (+78 additions, -0 deletions)
View changed files
📝
internal/lxc/config.go(+27 -0)📝
internal/lxc/config_test.go(+24 -0)📝
internal/lxc/manager.go(+27 -0)📄 Description
Problem
Apps that identify their own container by scanning
/proc/self/mountinfofor the 64-hex container ID — e.g. Wolf (get_current_container) — can't on the LXC/PVE path. Docker bind-mounts/etc/hostnamefrom/var/lib/docker/containers/<id>/hostname, so the ID is in mountinfo; the daemon never did this, so the ID is absent. Wolf then logs "No valid container ID found in mountinfo / automatic mounts matching is disabled" and can't translate host↔container paths, which breaks the udev records / device mapping it pushes into sibling session containers (e.g. virtual controllers get no working input).Fix
Write the hostname to
<statepath>/containers/<id>/hostnameand bind-mount it at/etc/hostname(both the PVE-CT and docker build paths), matching Docker's…/containers/<id>/hostnamebind. Removed with the container.Verification
go test ./internal/lxc/passes; newTestContainerIDHostnameBindcovers both build paths.Detected mounted /etc/wolf in the host as /etc/wolf//run/user/wolf …(automatic mounts matching enabled).🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.