Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| linux:lxd [2018/06/21 16:19] – jlucas | linux:lxd [2018/06/21 16:32] (current) – jlucas | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| + | ======Using LXD/LXC for containers======= | ||
| + | |||
| + | These commands work on Ubuntu 18.04 with LXD v3.1 | ||
| + | |||
| + | =====Install & Setup====== | ||
| + | |||
| + | Install | ||
| + | sudo apt install lxd | ||
| + | |||
| + | Configure | ||
| + | sudo lxc | ||
| + | |||
| + | Download initial images database | ||
| + | sudo lxc | ||
| + | |||
| + | Display help for a given command | ||
| + | sudo lxc help [command] | ||
| + | |||
| + | =====Basic usage===== | ||
| + | |||
| + | List existing container and their current state | ||
| + | sudo lxc list | ||
| + | |||
| + | Create and start new container | ||
| + | sudo lxc launch images: | ||
| + | |||
| + | Connect to container console - To detach from the console, press: < | ||
| + | sudo lxc console container-name | ||
| + | |||
| + | Another way to connect to a container | ||
| + | sudo lxc exec container-name /bin/bash | ||
| + | |||
| + | Stop container | ||
| + | sudo lxc stop container-name | ||
| + | |||
| + | Start container | ||
| + | sudo lxc start container-name | ||
| + | |||
| + | =====More advanced===== | ||
| + | |||
| + | ====Snapshots==== | ||
| + | |||
| + | List current snapshot for a given container | ||
| + | sudo lxc info container-name | ||
| + | |||
| + | Take a snapshot of a container | ||
| + | sudo lxc snapshot container-name [custom_snapshot_name; | ||
| + | |||
| + | Create new container from existing container snapshot | ||
| + | sudo lxc copy container-name snap_name new-container-name | ||
| + | |||