Help us shape the future of Go! Take the 2026 Go Developer Survey

selfcontainer

package
v1.10.17 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 12, 2026 License: AGPL-3.0, Apache-2.0 Imports: 4 Imported by: 0

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 containerized. Resolution order, most to least reliable: MIABI_CONTAINER_ID, /proc/self/mountinfo (Docker bind-mounts /etc/hostname from /var/lib/docker/containers/<id>/), /proc/self/cgroup, hostname.

func Match

func Match(a, b string) bool

Match reports whether two container references identify the same container, tolerating the mix of short (12-char) and full (64-char) IDs Docker returns. It requires at least a 12-char overlap, so an empty reference never matches.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL