[lxc-devel] [lxd/master] Improve a first impression error message

markstos on Github lxc-bot at linuxcontainers.org
Tue Jan 28 02:14:53 UTC 2020


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 700 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20200127/5d3ad93f/attachment.bin>
-------------- next part --------------
From 71c5ffa1c2e4e1c36a84be7aaa595178df076c44 Mon Sep 17 00:00:00 2001
From: Mark Stosberg <mark at stosberg.com>
Date: Mon, 27 Jan 2020 21:14:37 -0500
Subject: [PATCH] Improve a first impression error message

The first thing a new user might try to do is create a new container named after a distro: "ubuntu-18.04".

This fails with an error that the name is not valid, but wasn't clear about the problem.

This clarifies that the container name is supposed to be a valid *DNS* hostname. Since dots seem like a common problem in potential container names, those are called out specifically as a problem.
---
 lxd/container.go | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lxd/container.go b/lxd/container.go
index e86439c2df..58fe1fbc09 100644
--- a/lxd/container.go
+++ b/lxd/container.go
@@ -61,7 +61,7 @@ func containerValidName(name string) error {
 	}
 
 	if !shared.ValidHostname(name) {
-		return fmt.Errorf("Container name isn't a valid hostname")
+		return fmt.Errorf("Container name isn't a valid DNS hostname. Names may not contain dots.")
 	}
 
 	return nil


More information about the lxc-devel mailing list