-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Set $container_uuid for systemd containers #13187
Comments
I agree this is a good idea. I think you would just truncate the container id to 64 chars. I am still not sure what functionality this would add. |
It's a small thing for sure. Having a machine-id tied to the lifetime of the container is semantically what you want. I am not sure to what extent the dbus / systemd machine-id is used by software, but on the flip side it exists and it should be as correct as can be. |
I'm happy to send a PR, but I wanted to open an issue first to discuss wisdom (do we want this) and strategy (I am not very familiar with podman or libpod). |
Open a PR, I think it makes sense. |
May I add a suggestion to this feature request?
This would be super helpful too. Since ENV vars can be overwritten, an immutable file that has a container UUID would be awesome to have available inside the container. |
I considered adding this file as well, but looking at the systemd code, it is never read. I suppose it exists for other software. In any case, it seems like a good addition and I'll see if I can spend the time to add it. |
Thank you @jfroy! |
This patch sets the `container_uuid` environment variable to the container's fist 32 characters. This patch also mounts a basic /run/host that contains container-manager and container-uuid. See https://systemd.io/CONTAINER_INTERFACE for the details. Fixed containers#13187 Signed-off-by: Jean-Francois Roy <[email protected]>
A friendly reminder that this issue had no activity for 30 days. |
systemd expects the container_uuid environment variable be set when it is running in a container. Fixes: containers#13187 Signed-off-by: Daniel J Walsh <[email protected]>
/kind feature
Description
Set
$container_uuid
for containers running in systemd mode. From https://systemd.io/CONTAINER_INTERFACE/:The UUID could be derived from the container ID's first 128 bits, or by mixing the full container ID's 256 bits. Doing it that way does mean that the
$container_uuid
variable would be set fairly late in the container creation process, perhaps inRuntime::setupContainer
.The text was updated successfully, but these errors were encountered: