LXC LXD

Aus robopagex.com
Version vom 25. März 2022, 15:32 Uhr von Geist (Diskussion | Beiträge)
(Unterschied) ← Nächstältere Version | Aktuelle Version (Unterschied) | Nächstjüngere Version → (Unterschied)
Zur Navigation springen Zur Suche springen
LXC > LXD
    > Docker
    > CoreOS
    > Rocket
Pure-Play LXC, separate Prozess
lxd init
Would you like to use LXD clustering? (yes/no) [default=no]: 
Do you want to configure a new storage pool? (yes/no) [default=yes]: 
Name of the new storage pool [default=default]: lxdstorage          
Name of the storage backend to use (ceph, btrfs, dir, lvm) [default=btrfs]: 
Create a new BTRFS 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=15GB]: 5GB
Would you like to connect to a MAAS server? (yes/no) [default=no]: 
Would you like to create a new local network bridge? (yes/no) [default=yes]: 
What should the new bridge be called? [default=lxdbr0]: 
What IPv4 address should be used? (CIDR subnet notation, “auto” or “none”) [default=auto]: 
What IPv6 address should be used? (CIDR subnet notation, “auto” or “none”) [default=auto]: 
Would you like the LXD server to be available over the network? (yes/no) [default=no]: yes
Address to bind LXD to (not including port) [default=all]: 
Port to bind LXD to [default=8888]: 
Trust password for new clients: 
Again: 
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]: 
lxc list
lxc image list
lxc remote list 
lxc launch images:alpine/3.11 alpinebasic
lxc delete --force alpine alpinebasic
lxc image delete 834c
lxc image copy images:alpine/3.11 local: --alias mybasicalpine
lxc launch mybasicalpine nginx
lxc exec alpine -- ash
lxc exec nginx -- apk update
lxc exec nginx -- apk add nginx
lxc exec nginx -- apk add nano
$ apk add openssh
lxd exec file edit nginx/etc/nginx/conf.d/default.conf
lxc exec nginx nano /etc/nginx/conf.d/default.conf
lxc exec nginx -- ash
lxc exec file edit nginx/etc/nginx/conf.d/default.conf
IM CONTaINER -- ash
nano index.html 
/var/www 
# rc-update add nginx default
SNAPSHOT
lxc snapshot nginx nginx1.0
lxc info nginx // iamge info
lxc snapshot nginx nginx1.1
lxc copy nginx/nginx1.0 nginx2

lxc start container
lxc stop container
lxc move nginx2 nginx21
lxc info nginx
#snapshot delete
lxc delete nginx/nginx1.1
lxc delete --force alpine
#remotes
lxc image list images:
lxc image list images:debian
lxc image list images:alpine | grep alpine
ps -ef | grep lxd
lxc config set core.https_address "[::]:8888"
lxc config set core.trust_password xxx
lxc remote add repoA X.X.X.X:8888 --password=XXXXX --accept-certificate
lxc image copy images:alpine/3.13 local: --alias alpine313
lxc launch alpine313 web1
lxc image list repoA:
lxc list repoA:
lxc exec nginx -- apk add curl
#IMPORT/EXPORT/PUBLISH
lxc launch publish nginx/nginx1.0 --alias nginx4clone
lxc image export nginx4clone images/
tar -cvzf nginx5clone.tar.gz rootfs/ templates/ metadata.yaml 
lxc image import nginx5clone.tar.gz --alias nginx5
apt install debootstrap
debootstrap sid /tmp/debian-lxc/
free -h
lxc exec nginx -- free 
lxc config set ubuntu limits.memory 512MB
lxc config set ubuntu limits.cpu 2
lxc storage list lxd
lxc storage volume list nginx


  1. lxc storage create pool lvm source=host1-vg lvm.vg.force_reuse=true lvm.use_thinpool=true lvm.thinpool_name=lxd-pool

lxc storage info