Nested LXD, how?

Serge Hallyn serge.hallyn at ubuntu.com
Fri Oct 23 17:55:58 UTC 2015


On the host, edit /etc/subuid and /etc/subgid to allocate sufficient uid
ranges.  In the root:firstuid:range entries, change range to be, let's say,
200000.  So something like

root:100000:200000
lxd:100000:200000

(I'm showing both root and lxd bc which to use depends on your lxd version,
I think)

Initialize a container,

lxc init wily w1
lxc config set w1 security.nesting 1
lxc start w1

Now inside w1, edit /etc/subuid and /etc/subgid to make sure the root
allcoations do not go past 200000.  so set them to say:

root:100000:65536
lxd:100000:65536

Now you should be able to launch a container inside w1.  (I just tried
this in a fresh vm, worked here)

I should do a blog post on this soon.

Quoting Martinx - ジェームズ (thiagocmartinsc at gmail.com):
> Guys,
> 
>  I need to create 4, or more, LXD containers, inside 1 LXD container.
> 
>  How to do that?
> 
>  The first LXD container, is running on a KVM (or bare-metal) host,
> with Ubuntu 14.04 + LXD 0.20 (ppa:ubuntu-lxc/lxd-stable).
> 
>  I really appreciate any help!
> 
>  I'm seeing that both LXC itself, and LXD, supported nested containers but, how?
> 
>  I'm trying but, it doesn't work...
> 
>  Thanks in advance!
> 
> Best,
> Thiago
> 
> -- 
> ubuntu-server mailing list
> ubuntu-server at lists.ubuntu.com
> https://lists.ubuntu.com/mailman/listinfo/ubuntu-server
> More info: https://wiki.ubuntu.com/ServerTeam




More information about the ubuntu-server mailing list