[lxc-devel] Valid Container Names/Identifiers

Dwight Engen dwight.engen at oracle.com
Tue Dec 16 19:57:47 UTC 2014


On Tue, 16 Dec 2014 10:22:05 -0500
Stéphane Graber <stgraber at ubuntu.com> wrote:

> On Tue, Dec 16, 2014 at 10:36:13AM +0100, Till Walter wrote:
> > Dear LXC Developers,
> > 
> > the manual page of lxc-create states that "The container identifier
> > format is an alphanumeric string". Yet besides [A-Za-z0-9] other
> > characters like underscore are also fine.
> > I had a brief look at the source but did not find any check, e.g.,
> > using a regex. Is there any check at all? What are valid container
> > identifiers/names?
> > I am asking because I am using the official python bindings to
> > write a little utility and want to avoid container naming problems
> > that may arise.
> > 
> > Best regards,
> > 
> > BB
> 
> So LXC itself doesn't really have a definition for valid names,
> however since the name is typically used for the container's
> hostname, you should stick to what's considered a valid hostname on
> Linux.
> 
> There's a POSIX RFC for that but IIRC it's basically 64 chars ASCII.

Also note that if you're using the cgfs cgroup backend, the name must
pass is_valid_cgroup(), which has a comment that says:

/* Use the ASCII printable characters range(32 - 127)
 * is reasonable, we kick out 32(SPACE) because it'll
 * break legacy lxc-ls
 */

I guess its a bit not nice that it looks like we don't check at create
time, but will fail it from starting later.


More information about the lxc-devel mailing list