Give containers unique machine-id based off container ID#6457
Closed
mheon wants to merge 1 commit intomoby:masterfrom
Closed
Give containers unique machine-id based off container ID#6457mheon wants to merge 1 commit intomoby:masterfrom
mheon wants to merge 1 commit intomoby:masterfrom
Conversation
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)
Contributor
Author
|
PR #6481 duplicates this, but seems better implemented - closing this in favor of the new PR. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.