https://linuxcontainers.org/incus
incus admin init
incus profile list
incus cluster list
incus network list
incus remote list
incus image list
$ incus image list images: | more
Or specifically Alpine for arm64 (MacOS)
$ incus image list images:alpine arm64
$ incus network attach-profile vlanbr0 default
$ incus image copy images:4c307beb1d38 local:
# set alias for image
$ incus image alias create alpine/[email protected] 4c307beb1d38 --debug --verbose
$ incus exec ruling-treefrog -- sh -c 'passwd'
# add user
$ lxc exec apache1 -- sudo --user ubuntu --login
# Alpine image
$ incus launch local:4c307beb1d38 --debug --console
# with alias
$ incus launch local:alpine/[email protected]
# ubuntu vm
$ incus launch ubuntu:24.04 my-vm --vm
# ubuntu container
$ incus launch ubuntu:24.04 my-container
$ incus launch images:alpine/edge alpine
$ incus launch images:debian/12 debian --vm
# with limits
$ incus launch images:ubuntu/24.04 limited -c limits.cpu=1 -c limits.memory=192MiB
$ incus info debian
$ incus config show limited
# show server resources
$ free -m
$ incus exec limited -- free -m
# check cpus available
$ nproc
$ incus exec limited -- nproc
# change resource while running
$ incus config set limited limits.memory=128MiB
# Pull a file from the instance:
$ incus file pull first/etc/hosts .
# Add an entry to the file:
$ echo "1.2.3.4 my-example" >> hosts
# Push the file back to the instance:
$ incus file push hosts first/etc/hosts
# Use the same mechanism to access log files:
$ incus file pull first/var/log/syslog - | more
q
Incus supports creating and restoring instance snapshots.
# Create a snapshot called "clean":
$ incus snapshot create first clean
# Confirm that the snapshot has been created:
$ incus snapshot list first
# Break the instance:
$ incus exec first -- rm -Rf /etc /usr
# Confirm the breakage:
$ incus exec first -- bash
# Note that you do not get a shell, because you deleted the bash command.
# Restore the instance to the snapshotted state:
$ incus snapshot restore first clean
# Confirm that everything is back to normal:
$ incus exec first -- bash
$ exit
# Delete the snapshot:
$ incus snapshot delete first clean
$ incus start debian
$ incus stop debian
$ incus delete debian
$ incus delete debian --force
$ incus storage list
$ incus storage volume list local
# enlarge vm volume
$ incus config device override test-vm root size=20GiB
# Restart
$ incus restart test-vm
# We can create additional storage volumes in the default storage pool
$ incus storage volume create default mydisk size=10GB --type=block
# Attach new volume to the test-vm
$ incus storage volume attach default mydisk test-vm
socat tcp-listen:8080,reuseaddr,fork TCP:10.0.3.17:80
# on ubuntu see if port 8443 is used
ss -tuln | grep 8443
$ curl --unix-socket /var/lib/incus/unix.socket incus/1.0
Here API calls when image launced with:
-
POST http://unix.socket/1.0/instances
{ "architecture": "", "config": {}, "devices": {}, "ephemeral": false, "profiles": null, "stateful": false, "description": "", "name": "", "source": { "type": "image", "certificate": "", "fingerprint": "4c307beb1d38b447353f15732d262716d7428a7a29af2c1557393cfc8c973203", "allow_inconsistent": false }, "instance_type": "", "type": "container", "start": true }
-
GET http://unix.socket/1.0/operations/b48c0cac-86d5-4352-b9a1-efc6f79c2ce0
-
POST http://unix.socket/1.0/instances/main-hagfish/console
{ "width": 170, "height": 56, "type": "console" }
Exist console: +a q