LXDoNe: matching container name with hostname


Would anybody know what do I have to do so after instantiating a container its name matches the OS host name?

Right now, I have something like:
Container name: “one-514”
OS hostname: “lxdtest000”

And I’d like to have something like:
Container name: “lxdtest000”
OS hostname: “lxdtest000”

By the way, this for OpenNebula 5.4.6/LXDoNe 5.4-5/LXD 2.0.11 running on Ubuntu 16.04.

Thanks a lot,


You might wnat to read this


You can control the content of files inside the container through its metadata. For example,

"{{ config_get("user.hostname", "lxdone")}}"

in the templates/hostname.tpl file would name the container lxdone always

Hi Daniel,

And sorry for not being clearer on my post…: I was thinking about something that could possibly be configured at OpenNebula’s VM template level.

It seams that by default the container, at LXD level, is named by using OpenNebula’s “DEPLOY_ID” variable. I’d like to change that, so the container’s name would be set by using OpenNebula’s “NAME” variable.



Oh, maybe you should rename the title to something oriented to VM naming in OpenNebula, so people don’t skip it when they see LXDoNe.

Maybe something from this could be helpful


Hi Daniel,

OK, I’ll take a look at that. Thanks a lot…!