Skip to content

Give containers unique machine-id based off container ID#6457

Closed
mheon wants to merge 1 commit intomoby:masterfrom
mheon:machine_id
Closed

Give containers unique machine-id based off container ID#6457
mheon wants to merge 1 commit intomoby:masterfrom
mheon:machine_id

Conversation

@mheon
Copy link
Contributor

@mheon mheon commented Jun 16, 2014

Currently, all containers on a host share a single machine ID, accessible in /etc/machine-id. This patch adds a per-container unique ID (formed by truncating the container's ID). Programs which report information based off or identified by machine-id can now distinguish which container they are in.

Major application for this is logging with journald - these logs are distinguished based on machine-id, and with a unique per-container machine-id and a few symlinks, an in-container systemd instance can send logs (uniquely tied to the generating container) to the host.

The first 32 characters (16 hex-encoded bytes) of a container's UUID are placed
in a file in the container's context path, then bind mounted to /etc/machine-id
This provides each container with an ID unique from the host system

Fixed docker diff test case to include new file, preventing breakage

Docker-DCO-1.1-Signed-off-by: Matt Heon <[email protected]> (github: mheon)
@mheon
Copy link
Contributor Author

mheon commented Jun 17, 2014

PR #6481 duplicates this, but seems better implemented - closing this in favor of the new PR.

@mheon mheon closed this Jun 17, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant