From 0dafe12f603a7a190bebe5314341681eedec7785 Mon Sep 17 00:00:00 2001 From: Amolith Date: Tue, 18 Jul 2023 13:21:24 -0400 Subject: [PATCH] work on LXD blog post --- .../posts/lxd-containers-for-human-beings.md | 72 +++++++++++++++++++ 1 file changed, 72 insertions(+) diff --git a/content/posts/lxd-containers-for-human-beings.md b/content/posts/lxd-containers-for-human-beings.md index 2a13db8..a8044a5 100644 --- a/content/posts/lxd-containers-for-human-beings.md +++ b/content/posts/lxd-containers-for-human-beings.md @@ -34,3 +34,75 @@ there's unfortunately nothing I can do about that. on bare metal servers as necessary. - **Density:** - **Cleanliness:** + +## Virtual machines + +```goat + .---------------------------------. +| .-------. .-------. .-------. | +| | Guest | | Guest | | Guest | | +| | OS | | OS | | OS | | +| .---+---' .---+---' .---+---' | +| .--+----. .--+----. .--+----. | +| | Guest | | Guest | | Guest | | +| | Kernel | | Kernel | | Kernel | | +| .---+---' .---+---' .---+---' | +| .--+----------+----------+----. | +| | Hypervisor | | +| .--------------+--------------' | +| .-------------+---------------. | +| | Host Kernel | | +| .-----------------------------' | +.---------------------------------' +``` + +## Containers + +```goat + Application containers System containers + .---------------------------------. .------------------------------. +| .-------. .-------. .-------. | | .------. .------. .------. | +| | App 01 | | App 02 | | App 03 | | | | Guest | | Guest | | Guest | | +| '---+---' '---+---' '---+---' | | | OS | | OS | | OS | | +| .--+----------+----------+----. | | '---+--' '---+--' '---+--' | +| | Hypervisor | | | .--+---------+---------+---. | +| '--------------+--------------' | | | Host Kernel | | +| .-------------+---------------. | | '--------------------------' | +| | Host Kernel | | '------------------------------' +| '-----------------------------' | +'---------------------------------' +``` + +## When to use which + +### Virtual machines + +- Virtualising esoteric hardware +- Virtualising non-Linux operating systems (Windows, macOS) +- Completely isolating processes from one another with a decades-old, battle-tested technique + +> See Drew DeVault's blog post [_In praise of qemu_](https://earl.run/rmBs) for a great use of VMs + +### Application containers + +- Microservices +- Extremely reproducible builds + - (NixOS.org would likely be a better fit though) +- Dead-set on using cloud platforms with extreme scaling capabilities (AWS, GCP, etc.) +- When the app you want to run is _only_ distributed as a Docker container and + the maintainers adamantly refuse to support any other deployment method + - (Docker does run in LXD 😉) + +### System containers + +- Anything not listed above 👍 + +## Crash course to LXD + +1. Install snap following [Canonical's tutorial](https://earl.run/ZvUK) + - LXD is natively packaged for Arch and Alpine, but configuration can be a massive headache. +2. `sudo snap install lxd` +3. `lxd init` +4. `lxc image copy images:debian/11 local: --alias deb-11` +5. `lxc launch deb-11 container-name` +6. `lxc shell container-name`