# LXDoNe: matching container name with hostname

**URL:** <https://forum.opennebula.io/t/lxdone-matching-container-name-with-hostname/6193>\
**Category:** Product Support\
**Created:** [July 24, 2018, 9:15pm UTC](https://forum.opennebula.io/t/lxdone-matching-container-name-with-hostname/6193 "2018-07-24T21:15:09Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![AlexW](https://avatars.discourse-cdn.com/v4/letter/a/b5a626/32.png) [@AlexW](https://forum.opennebula.io/u/AlexW)\
**Post date:** [July 24, 2018, 9:15pm UTC](https://forum.opennebula.io/t/lxdone-matching-container-name-with-hostname/6193/1 "2018-07-24T21:15:10Z")

</div>

Hello,

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,

Alex

---

<div class="post-metadata">

**Author:** ![dclavijo](https://yyz1.discourse-cdn.com/flex031/user_avatar/forum.opennebula.io/dclavijo/32/5265_2.png) [@dclavijo](https://forum.opennebula.io/u/dclavijo)\
**Post date:** [July 24, 2018, 9:57pm UTC](https://forum.opennebula.io/t/lxdone-matching-container-name-with-hostname/6193/2 "2018-07-24T21:57:22Z")

</div>

You might wnat to read this

[https://lxd.readthedocs.io/en/latest/image-handling/#content](https://lxd.readthedocs.io/en/latest/image-handling/#content)

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

---

<div class="post-metadata">

**Author:** ![AlexW](https://avatars.discourse-cdn.com/v4/letter/a/b5a626/32.png) [@AlexW](https://forum.opennebula.io/u/AlexW)\
**Post date:** [July 25, 2018, 8:54pm UTC](https://forum.opennebula.io/t/lxdone-matching-container-name-with-hostname/6193/3 "2018-07-25T20:54:36Z")

</div>

Hi Daniel,

Thanks!  
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.

Regards,

Alex

---

<div class="post-metadata">

**Author:** ![dclavijo](https://yyz1.discourse-cdn.com/flex031/user_avatar/forum.opennebula.io/dclavijo/32/5265_2.png) [@dclavijo](https://forum.opennebula.io/u/dclavijo)\
**Post date:** [July 25, 2018, 9:00pm UTC](https://forum.opennebula.io/t/lxdone-matching-container-name-with-hostname/6193/4 "2018-07-25T21:00:55Z")

</div>

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

[http://docs.opennebula.org/5.6/operation/vm\_management/vm\_instances.html](http://docs.opennebula.org/5.6/operation/vm_management/vm_instances.html)  
[http://docs.opennebula.org/5.6/operation/vm\_management/vm\_templates.html](http://docs.opennebula.org/5.6/operation/vm_management/vm_templates.html)

---

<div class="post-metadata">

**Author:** ![AlexW](https://avatars.discourse-cdn.com/v4/letter/a/b5a626/32.png) [@AlexW](https://forum.opennebula.io/u/AlexW)\
**Post date:** [July 25, 2018, 9:59pm UTC](https://forum.opennebula.io/t/lxdone-matching-container-name-with-hostname/6193/5 "2018-07-25T21:59:46Z")

</div>

Hi Daniel,

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

Regards,

Alex
