LXC and LXD Cheat Sheet¶
Quick-reference CLI guide for managing LXC/LXD system containers.
Container Lifecycle¶
Most modern implementations use the lxc command-line tool (part of the LXD project).
List Containers:
Launch New Container:
Example (Ubuntu):
Start Container:
Stop Container:
Restart Container:
Delete Container:
Show Container Info:
Access & Configuration¶
Interacting with the "inside" of an LXC container is very similar to interacting with a virtual machine.
Open Shell (Root):
Run Single Command:
Copy File TO Container:
Pull File FROM Container:
Edit Config:
Set Resource Limit:
Snapshots & Images¶
One of the best features of LXC is the ability to "freeze" a state before making risky changes.
Create Snapshot:
Restore Snapshot:
List Snapshots:
Delete Snapshot:
Publish as Image:
Network & Storage¶
List Networks:
Show Network Details:
List Storage Pools:
Create Managed Volume: