Lxd: Container name isn't a valid hostname.

Created on 21 Dec 2015  路  3Comments  路  Source: lxc/lxd

Seems like the container name is being used for hostname directly or something and a "." breaks things. I wanted to add versioning to my image/container names

$ lxc launch images:ubuntu/trusty/amd64 test
Creating test done.
Starting test done.
$ lxc launch images:ubuntu/trusty/amd64 test123
Creating test123 done.
Starting test123 done.
$ lxc launch images:ubuntu/trusty/amd64 test1.0
Creating test1.0 error: Container name isn't a valid hostname.

Most helpful comment

That's correct, all container names must be a valid hostname under the most restrictive definition of this, that is, maximum 63 characters, may not contain dots, may not start by a digit or dash, may not end by a dash and must be made entirely of letters, digits or hyphens.

LXD in your case appears to behave exactly as designed, so not a bug.

I may suggest calling your container "test01" instead and incrementing that latter part which is compliant with hostname rules.

All 3 comments

That's correct, all container names must be a valid hostname under the most restrictive definition of this, that is, maximum 63 characters, may not contain dots, may not start by a digit or dash, may not end by a dash and must be made entirely of letters, digits or hyphens.

LXD in your case appears to behave exactly as designed, so not a bug.

I may suggest calling your container "test01" instead and incrementing that latter part which is compliant with hostname rules.

Oh and if you want to encode more information in the container, you can use the "user." config namespace.

lxc config set test user.version 1.0

At which point you can list those containers by their version with "lxc list user.version=1.0"

thanks

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jsnjack picture jsnjack  路  3Comments

AndreiPashkin picture AndreiPashkin  路  5Comments

teknopaul picture teknopaul  路  5Comments

chuegel picture chuegel  路  3Comments

kp3nguinz picture kp3nguinz  路  5Comments