LXD containers

Note:
This documentation has moved to a new home! Please update your bookmarks to the new URL for the up-to-date version of this page.

1 Like

AFAIU nowadays you can use lxc shell b1, which looks a lot better and is easier to remember. Is there any reason to use lxc exec instead?

lxc exec is generic. lxc shell is an internal alias, and does not appear when you lxc alias list.

I wish there was a built-in mechanism to get a non-root shell into a LXD container.
There are a few different ways to get a shell, https://blog.simos.info/using-command-aliases-in-lxd-to-exec-a-shell/

This will tell LXD to listen to port 8443 on all addresses.

1 Like

Thank you for spotting this typo, @worraps. I’ve fixed it now.

Thanks for the suggestion, @mgedmin, and thanks for following up, @simosx.

What @simosx said is totally valid, but I also believe that it’s worth mentioning lxc shell. I’ve adjusted the document to address it.

Thanks.

By following the instructions, the image downloaded should be bionic instead of xenial

Just to hint that exec exists, and can be used to execute arbitrary commands non-interactively. Useful for scripts, for example. The lxc shell variant is shown right after.

1 Like

This page would be more useful if there were HTML anchors throughout. I wanted to link someone directly to the security.nesting section but there is no way to do that. So the best I can do is say "search for security.nesting in https://ubuntu.com/server/docs/containers-lxd " and hope they find the right thing. I wish I could say read https://ubuntu.com/server/docs/containers-lxd#nesting and have that go right the correct section.

Thanks

1 Like

Thanks for your feedback @sarnold - there was an update to Discourse recently that should have implemented that as an automatic feature, and on some other pages I can see it has been, but for some reason not on all of them (this one included)! I appreciate you bringing it to our attention, I’ll do a bit more investigating and let you know once it’s working as expected.