Documentation
¶
Overview ¶
Package selfcontainer detects the Docker container ID of the running process, so Miabi can recognise its own container and refuse to stop or delete it from the admin containers list — which would take the platform offline.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Detect ¶
func Detect() string
Detect returns the ID of the container the process runs in, or "" when it is not running in a container (e.g. local development). Resolution order, most to least reliable:
- MIABI_CONTAINER_ID — an explicit operator/compose override.
- /proc/self/mountinfo — Docker bind-mounts /etc/hostname, /etc/hosts and /etc/resolv.conf from /var/lib/docker/containers/<id>/, giving the full ID.
- /proc/self/cgroup — the cgroup path carries the ID on cgroup v1.
- the hostname — Docker's default is the 12-char short ID.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.