Create an LXD Container¶
After at least one LXD node is enrolled you can spin up containers from the Containers tab.
Quick steps¶
- Containers tab → ➕ New Container.
- Fill in:
- Name — DNS-safe lowercase hostname.
- Host — pick an enrolled LXD node from the dropdown.
- Image — one of the alias entries from the node's cached images. If empty, pull one first with ⬇ Pull Image or Install an Appliance.
- Storage Pool — defaults to the image's preferred pool (set at pull time). Override only if you know better.
- Network —
None (no NIC)or one of the LXD networks. For OVN binding leave this onNoneand use the OVN section below. - CPU — vCPU limit (default 1).
- Memory (MB) — RAM limit (default 512).
- (Optional — OVN binding) Expand the OVN section:
- IPAM Pool — pick a pool bound to an OVN switch.
- MAC — leave blank to auto-generate a unique
00:16:3e:xx:xx:xx; or paste your own. - Static IP — leave blank to take the next free address from the pool.
- Create.
The container appears in the Containers table within a couple of seconds. A WebSocket task stream shows the LXD operation progressing through Pending → Creating → Started → Running.
What happens under the hood¶
- Master inserts a row in
lxd_containerswithstatus='Creating'. - (If OVN binding) Allocates an IP from the pool, picks/validates a MAC, INSERTs a lease.
- Enqueues a Celery task on the per-host queue (
compute-<ip-with-dashes>). - The worker on that host calls
LXDClient.create_instance(...)against the local LXD socket. - (If OVN binding) A
BackgroundTaskcallsovn-nbctl lsp-add lsp-<name>on an OVN-enabled host so the container's NIC is reachable on the tenant network. - Row flips to
Running(orErrorwith a friendly message in the task log).
Tips¶
- The first container created from a new image takes a minute or two — LXD has to import the image. Subsequent containers from the same image are seconds.
- Names with uppercase or dots break some LXD validation; stick to lowercase + hyphens (the modal validates this).
- For long-running services, set a snapshot schedule via the Snapshots flow before installing anything custom.