Docker Community Forums

Share and learn in the Docker community.

Host Machine-id visible from containers

Good evening,
since there is a lot of people arguing about licensing check from within containers, I was wondering if it were possible to have a new feature in docker CLI and in docker images base files such that

#docker machine-id
or similar
returns a unique uuid for the docker host


#cat /dev/machine-id
or similar
from within container returns the very same uuid returned by the cli command from the host machine

Thank you very much

For example:

version: ‘3’
image: image
- 8080:8080
restart: always
network_mode: “host”
- /etc/machine-id:/etc/machine-id
- /var/lib/dbus/machine-id:/var/lib/dbus/machine-id

not every OS has machine-id file neither in etc nor in var lib dbus, so it could not be working cross-platform.

Furthermore, to “force” a machine id would be as easy as changing the volume mount point in the docker-compose file.

So this solution can’t be accepted IMHO.

@alextm you can safely ignore lewish95: its a bot with none or terrible ai, every response it makes can be found by googling it.

I would also be interested in this feature, or if there is any workaround to achieve the same result. The idea is that each container should be able to have a unique and immutable id, which therefore takes into account some unique properties of the host machine, such as the machine-id in unix based os.

@frazcake My intent is to get the same id within every container, not a different id in each container… and they should be based on the host machine so that containers running on different hosts see different ids.

1 Like