- Programming-level, e.g. Python's Virtualenv
- Application encapsulating:, e.g.Docker (ephemeral, separate storage)
- OS encapsulating, e.g. LXC, LXD, and kind-of chroot (UNIX)
- Hardware virtualisation
- Heavyweight OS (Type 2 hosted hypervisor), e.g. Vagrant (depending on back-end), Virtualbox
- (Type 1 bare metal) Hypervisor, e.g. KVM, Hyper-V
Docker, LXC, LXD (uses LXC) all use, on Linux, Linux cgroups and namespaces(net, user, pid, ipc, cgroup).
Kubernetes can be used for orchestration.
You also have things like Firejail, Snap/Flatpak, and AppImage.
Containers may conflate:
- Security via isolation
- Packaging dependencies
- Efficient resource utilisation
Developing with Vagrant
Consider LXD as a lightweight, non-portable alternative.
This is useful if you are working on conflicting projects, or want to keep your computer tidy. Keep your setup on your host (text editor and IDE appliations and their config files), and run the project (any executables) within the container. A shared folder can be used to store the repository.
Vagrant is easy if you use the default Virtualbox provider. And, apparently, impossible with vagrant-lxc :/
- vagrant-vbguest to keep VirtualBox's Guest Additions up-to-date on the Vagrant box
- vagrant-notify-forwarder for filesystem event forwarding that is not reliable
- vagrant-disksize to easily increase the size of your Virtualbox disk
- vagrant-share to be able to share your container with others that I've never used
- vagrant-lxc for LXC boxes that don't work
Create a merging custom Vagrantfile in
If you encounter an issue with double port-forwarding (i.e. a port-forward inside the guest and then using Vagrant's port-forward to forward it to your host): https://stackoverflow.com/questions/49940964/windows-host-vagrant-kubectl-port-forward-stuck-inside-vagrant. TODO: I have no idea what that is doing ATM.
# Port Forward from local port 8000 to remote port 80, listening on all addresses so that Vagrant's port forwarding works.
kubectl port-forward --address 0.0.0.0 8000:80