Linux Containers: Difference between revisions
Jump to navigation
Jump to search
Line 96: | Line 96: | ||
{| | {| | ||
| valign="top" | | | valign="top" | | ||
* [https://dzone.com/articles/lxd-and-docker#:~:text=Can%20a%20hypervisor,%20Docker%20and%20LXD%20coexist Coexistence of Hypervisor, Docker & LXD] | * [https://dzone.com/articles/lxd-and-docker#:~:text=Can%20a%20hypervisor,%20Docker%20and%20LXD%20coexist Coexistence of Hypervisor, Docker & LXD] | ||
* [https://linuxcontainers.org/lxd/advanced-guide/ Linux Containers Cloud Init] | |||
* [https://snapcraft.io/docs/installing-snap-on-ubuntu Installing snap on Ubuntu] | * [https://snapcraft.io/docs/installing-snap-on-ubuntu Installing snap on Ubuntu] | ||
* [https://linuxcontainers.org/lxd/getting-started-cli/ Getting Started with LXC] | * [https://linuxcontainers.org/lxd/getting-started-cli/ Getting Started with LXC] | ||
Line 103: | Line 104: | ||
* [https://snapcraft.io/docs/installing-snapd Installing snapd] | * [https://snapcraft.io/docs/installing-snapd Installing snapd] | ||
* [https://www.upguard.com/blog/docker-vs-lxc Docker vs. LXC] | * [https://www.upguard.com/blog/docker-vs-lxc Docker vs. LXC] | ||
* [https://cloudinit.readthedocs.io/en/latest/ Linux Cloud Init] | |||
* [[Docker]] | * [[Docker]] | ||
Revision as of 18:13, 30 September 2021
sudo apt upgrade && sudo apt autoremove sudo snap install lxd --channel=4.0/stable
Initial Setup
sudo lxd init
:'
Would you like to use LXD clustering? (yes/no) [default=no]: yes
What IP address or DNS name should be used to reach this node? [default=10.20.21.10]:
Are you joining an existing cluster? (yes/no) [default=no]:
What name should be used to identify this node in the cluster? [default=academia]:
Setup password authentication on the cluster? (yes/no) [default=no]:
Do you want to configure a new local storage pool? (yes/no) [default=yes]:
Name of the storage backend to use (btrfs, dir, lvm, zfs) [default=zfs]:
Create a new ZFS pool? (yes/no) [default=yes]:
Would you like to use an existing empty block device (e.g. a disk or partition)? (yes/no) [default=no]:
Size in GB of the new loop device (1GB minimum) [default=100GB]:
Do you want to configure a new remote storage pool? (yes/no) [default=no]:
Would you like to connect to a MAAS server? (yes/no) [default=no]:
Would you like to configure LXD to use an existing bridge or host interface? (yes/no) [default=no]:
Would you like to create a new Fan overlay network? (yes/no) [default=yes]:
What subnet should be used as the Fan underlay? [default=auto]:
Would you like stale cached images to be updated automatically? (yes/no) [default=yes]
Would you like a YAML "lxd init" preseed to be printed? (yes/no) [default=no]:
'
Instance Management
lxc image list images: ubuntu amd64 lxc image list images: ubuntu arm64 lxc image list images: ubuntu
lxc launch ubuntu:21.04 academia --vm lxc launch ubuntu:21.04 academia lxc restart academia lxc start academia lxc stop academia
lxc list -c nsS lxc list
lxc exec academia -- su --login chorke lxc exec academia -- /bin/bash lxc exec academia bash lxc console academia
download from container to host lxc file pull academia/etc/hosts ./ upload into container from host lxc file push -r ~/.ssh/ academia/root/.ssh/ lxc file push ~/.ssh/known_hosts academia/root/.ssh/
lxc stop academia && lxc delete academia lxc delete academia --force
manipulate remote images lxc image refresh ubuntu:21.04 lxc image delete ubuntu:21.04 lxc image show ubuntu:21.04 lxc image edit ubuntu:21.04
manipulate local images lxc image delete 97c97f4a1d2d lxc image delete a7b1071c0609
Knowledge
sudo apt update && sudo apt list --upgradable sudo apt upgrade && sudo apt autoremove sudo apt install snapd
sudo snap install lxd --channel=4.0/stable sudo snap install lxd --channel=3.0/stable sudo snap install lxd sudo lxd.migrate
sudo lxd init --auto sudo lxd init
lxc remote list lxc image list
lxc image list images: alpine lxc image list images: alpine arm64 lxc image list images: alpine amd64
lxc image list images: debian lxc image list images: debian arm64 lxc image list images: debian amd64
lxc image list images: ubuntu lxc image list images: ubuntu arm64 lxc image list images: ubuntu amd64