-
Notifications
You must be signed in to change notification settings - Fork 144
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
No machine-id detected in docker containers #5
Comments
Did you try to share the file from the host to the container? For example:
|
This is a great library, thanks so much for writing it. It would be great if docker containerisation were detected, and then a unique container ID or some information was used as the machine ID - or if it exposed a Docker ID and the machine ID, and both could be used as a third unique ID. |
If neither of these paths exists, an empty string will be returned.
It works fine for my docker image |
Joining the party. It would be great to support docker by getting unique ids per container. |
Is there any progress on this? |
The machine id is looked in "canonical" locations. If not value is found, one is generated and persisted. The machine id is looked in: - the file pointed by the `MACHINE_ID_FILE` env var - `/var/lib/dbus/machine-id` - `/etc/machine-id` - `$HOME/.config/machine-id` If no such file is found, a random uuid is generated and persisted in the first writable file among `$MACHINE_ID_FILE`, `/var/lib/dbus/machine-id`, `/etc/machine-id`, `$HOME/.config/machine-id`. If there is an error reading _all_ the files an empty string is returned. The logic implemented is a variation of the one described in denisbrodbeck#5 (comment)
Since this repository seems unmaintained, I implemented a variation of this logic in github.com/panta/machineid, where it's also possible to specify the machine-id file using the |
It appears that Docker doesn't expose
/var/lib/dbus/machine-id
or/etc/machine-id
, so no machine-id gets detected inside docker containers.The text was updated successfully, but these errors were encountered: