Lxd Development Teams
Research Date: 2026-02-18
Topic: Using LXD for development team infrastructure
Executive Summary
This research evaluates using LXD (Linux Container Daemon) to provide isolated development environments for development teams. The analysis covers container configuration, Docker-in-LXD support, VS Code Remote SSH access, Ansible automation, and migration capabilities.
Findings
1. LXD Container Nesting for Docker Support
Finding: Docker can run inside unprivileged LXD containers using security.nesting=true without requiring privileged mode 12.
Verification: Canonical’s LXD documentation and community discussions confirm that security.nesting=true enables container nesting for unprivileged containers. Additional configuration options like security.syscalls.intercept.mknod=true and security.syscalls.intercept.setxattr=true may be required for full Docker functionality 23.
Implication: Development teams can run Docker and devcontainers inside LXD containers while maintaining security through unprivileged operation.
2. Docker Storage Driver Requirements in LXD
Finding: The vfs storage driver is not strictly required for Docker-in-LXD; fuse-overlayfs and modern kernel overlay2 support provide alternatives 456.
Verification:
- Docker’s official documentation states
vfsis “intended for testing purposes” with “poor performance” and “not generally recommended for production use” 4. fuse-overlayfsenables overlay filesystem in userspace without root permissions, suitable for unprivileged containers 56.- Modern kernels (5.11+) support
overlay2in rootless mode, and recent LXC/LXD versions with ZFS backing can useoverlay2directly 67.
Implication: The blanket recommendation to use vfs is outdated. Teams should prefer fuse-overlayfs or native overlay2 when available for significantly better performance.
3. Live Migration Capabilities
Finding: Live migration (zero-downtime migration) is supported for LXD virtual machines but requires stopping containers before migration 8910.
Verification:
- Official LXD documentation: “When migrating a container, you must stop it first. When migrating a virtual machine, you must either enable Live migration or stop it first” 8.
- VM live migration requires
migration.stateful=trueand sufficientsize.stateallocation 8. - Experimental CRIU-based container live migration exists but requires privileged containers and has significant limitations 910.
Implication: Development teams requiring migration without downtime must use LXD virtual machines, not containers.
4. SSH Access Methods
Finding: LXD supports multiple SSH access patterns: proxy devices for port forwarding and bridged networking for direct IP access 1112.
Verification:
- Proxy devices (
proxydevice type) forward host ports to container ports 11. - Bridged networking attaches containers directly to physical networks, allowing DHCP-assigned IPs 12.
- Default
lxdbr0is IPv6 link-local only and requires configuration for SSH access 11.
Implication: Proxy devices are simpler for multi-developer scenarios where each container needs unique SSH ports; bridged networking suits environments requiring direct LAN access.
5. Ansible LXD Module Support
Finding: Ansible provides official community.general.lxd_container module for LXD container management 13.
Verification:
- The module supports creating, starting, stopping, and deleting containers and VMs 13.
- Configuration options include
security.nesting, resource limits, and device attachments 13. - The module requires
community.generalcollection installation 13.
Implication: Infrastructure-as-code automation for LXD development environments is well-supported through standard Ansible tooling.
6. Security Considerations
Finding: Unprivileged LXD containers provide strong isolation while supporting nested containers through security.nesting 114.
Verification:
- Canonical recommends unprivileged containers for security, with
security.nesting=truefor Docker support 1. - Privileged containers bypass security controls and should be avoided 14.
- Resource limits (
limits.memory,limits.cpu,limits.disk) prevent resource exhaustion 15.
Implication: Development environments should use unprivileged containers with appropriate nesting and resource limits.
Recommendations
| Decision | Recommendation | Rationale |
|---|---|---|
| Container Type | Unprivileged LXD with security.nesting=true |
Security with Docker support 114 |
| Docker Storage | fuse-overlayfs or overlay2 (if available) |
Better performance than vfs 456 |
| SSH Access | Proxy devices | Simpler port management for multi-developer setups 11 |
| Automation | Ansible community.general.lxd_container |
Official, maintained module support 13 |
| Migration | Plan for downtime (stop-move-start) | Containers don’t support live migration 8 |
| Alternative for Live Migration | Use LXD VMs | VMs support live migration with migration.stateful=true 8 |
References
Configuration Examples
The following configuration examples are derived from official documentation and verified sources. They demonstrate practical implementation of the findings above.
Example 1: Creating Developer Containers with Nesting
Create an unprivileged container with nesting enabled for Docker support 115:
Verified: The -c flag sets configuration options at launch time. security.nesting=true enables nested containers for Docker support 115.
Example 2: Resource Limits Configuration
Configure resource limits for development containers 15:
Verified: Resource limits prevent container resource exhaustion. Options include limits.memory, limits.cpu, limits.disk, and limits.processes 15.
Example 3: SSH Access via Proxy Device
Forward host port 2222 to container port 22 for SSH access 1116:
Verified: Proxy devices forward traffic from host listeners to container endpoints. The listen address is on the host, connect address is inside the container 1116.
Example 4: Running Commands in Containers
Execute commands inside containers using lxc exec 17:
Verified: lxc exec executes commands directly in the instance. For interactive sessions, both stdin and stdout must be terminals 17.
Example 5: Ansible LXD Container Creation
Create and manage containers with Ansible 1318:
Verified: The community.general.lxd_container module supports full container lifecycle management. Configuration options match LXD CLI options 1318.
Reference URLs
Revision History
| Date | Version | Changes | Author |
|---|---|---|---|
| 2026-02-18 | 1.0 | Initial research document | Count |
| 2026-02-18 | 2.0 | Reorganized to finding-based format; added numbered citations; verified all claims; corrected Docker storage driver recommendations; added References and Revision History sections | Count |
Research completed: 2026-02-18
Repository: https://git.home.luguber.info/claw/research
Issue: https://git.home.luguber.info/claw/research/issues/4
-
Canonical. (2024). “Enable
security.nestingby default for unprivileged containers and modern enough images.” GitHub Issue #13631. https://github.com/canonical/lxd/issues/13631 ↩︎ ↩︎ ↩︎ ↩︎ ↩︎ ↩︎ -
Linux Containers Forum. (2022). “LXD nesting containers with Docker.” https://discuss.linuxcontainers.org/t/lxd-nesting-containers-with-docker/13713 ↩︎ ↩︎
-
Proxmox Support Forum. (2018). “LXC security.nesting.” https://forum.proxmox.com/threads/lxc-security-nesting.44726/ ↩︎
-
Docker Inc. (2025). “Select a storage driver.” Docker Documentation. https://docs.docker.com/engine/storage/drivers/select-storage-driver/ ↩︎ ↩︎ ↩︎
-
c-goes’s Linux Blog. (2020). “How to setup Docker with fuse-overlayfs in Proxmox LXC container.” https://c-goes.github.io/posts/proxmox-lxc-docker-fuse-overlayfs/ ↩︎ ↩︎ ↩︎
-
Reddit r/Proxmox. (2022). “fuse overlayfs?” https://www.reddit.com/r/Proxmox/comments/va76fz/fuse_overlayfs/ ↩︎ ↩︎ ↩︎ ↩︎
-
Proxmox Support Forum. (2023). “LXC ZFS + docker overlay2 driver.” https://forum.proxmox.com/threads/lxc-zfs-docker-overlay2-driver.122621/ ↩︎
-
Canonical. (2025). “How to migrate LXD instances between servers.” Ubuntu LXD Documentation. https://documentation.ubuntu.com/lxd/latest/howto/instances_migrate/ ↩︎ ↩︎ ↩︎ ↩︎ ↩︎
-
Ubuntu Blog. (2015). “Live Migration in LXD.” https://ubuntu.com/blog/live-migration-in-lxd ↩︎ ↩︎
-
Linux Containers Forum. (2023). “[LXD] Online VM live-migration (QEMU to QEMU).” https://discuss.linuxcontainers.org/t/lxd-online-vm-live-migration-qemu-to-qemu/16635 ↩︎ ↩︎
-
Canonical. (2016). “LXD networking: lxdbr0 explained.” https://canonical.com/blog/lxd-networking-lxdbr0-explained ↩︎ ↩︎ ↩︎ ↩︎ ↩︎ ↩︎
-
Paskevic, D. “Using a bridged LXD network.” https://casept.github.io/post/lxd-bridged/ ↩︎ ↩︎
-
Ansible Community. (2025). “community.general.lxd_container module – Manage LXD instances.” Ansible Documentation. https://docs.ansible.com/projects/ansible/latest/collections/community/general/lxd_container_module.html ↩︎ ↩︎ ↩︎ ↩︎ ↩︎ ↩︎ ↩︎
-
Linux Containers Forum. (2022). “Unprivileged containers inside privileged LXD container.” https://discuss.linuxcontainers.org/t/unprivileged-containers-inside-privileged-lxd-container/14841 ↩︎ ↩︎ ↩︎
-
Canonical. (2025). “Instance options.” LXD Documentation. https://documentation.ubuntu.com/lxd/latest/reference/instance_options/ ↩︎ ↩︎ ↩︎ ↩︎ ↩︎
-
Canonical. (2025). “Type: proxy.” LXD Documentation. https://documentation.ubuntu.com/lxd/latest/reference/devices_proxy/ ↩︎ ↩︎
-
Canonical. (2025). “How to run commands in an instance.” LXD Documentation. https://documentation.ubuntu.com/lxd/latest/instance-exec/ ↩︎ ↩︎
-
Canonical. (2025). “lxc launch.” LXD Documentation. https://documentation.ubuntu.com/lxd/latest/reference/manpages/lxc/launch/ ↩︎ ↩︎