You are here
Linux Container, Incus Spickliste
Seitenübersicht
- Container kopieren
- Container clonen
- Container als tarball exportieren und importieren
- Autostart eines Containers deaktivieren
- Launch new Container from Image server
- Container umbenennen
- File von Host in Container kopieren/pushen
- Wo liegen die Container rum?
- Quellen
Container kopieren
Noch zu testen:
shell> incus remote add shell> incus copy CONTAINER_NAME/SNAPSHOT_NAME target:CONTAINER_NAME"
Container clonen
shell> incus copy ubuntu-container qa-mariadb106-r
Container als tarball exportieren und importieren
shell> incus stop qa-glb shell> incus publish qa-glb --alias my-export Container published with fingerprint: 9f8410af601eb238224919943d146bc1bcd86429c2dcd5332b7d1bcf271d598d shell> incus image export my-export . Image exported successfully! shell> incus start qa-glb shell> ls -ltr *.tar.gz -rw-rw-r-- 1 oli oli 193735169 Oct 17 09:54 9f8410af601eb238224919943d146bc1bcd86429c2dcd5332b7d1bcf271d598d.tar.gz shell> scp 9f8410af601eb238224919943d146bc1bcd86429c2dcd5332b7d1bcf271d598d.tar.gz root@othermachine: shell> incus image import 9f8410af601eb238224919943d146bc1bcd86429c2dcd5332b7d1bcf271d598d.tar.gz --alias my-export Image imported with fingerprint: 9f8410af601eb238224919943d146bc1bcd86429c2dcd5332b7d1bcf271d598d shell> incus init my-export qa-glb Creating qa-glb shell> incus start qa-glb shell> incus list +----------------+---------+----------------------+-----------------------------------------------+-----------+-----------+ | NAME | STATE | IPV4 | IPV6 | TYPE | SNAPSHOTS | +----------------+---------+----------------------+-----------------------------------------------+-----------+-----------+ | qa-glb | RUNNING | 10.153.125.95 (eth0) | | CONTAINER | 0 | +----------------+---------+----------------------+-----------------------------------------------+-----------+-----------+
Autostart eines Containers deaktivieren
Wichtig: Wenn nichts gesetzt ist, bleibt die Ausgabe leer!
CONTAINER_NAME='qa-glb' shell> incus config set ${CONTAINER_NAME} boot.autostart false shell> incus config show ${CONTAINER_NAME} architecture: x86_64 config: boot.autostart: "false" image.architecture: amd64 image.description: Ubuntu jammy amd64 (20221013_07:42) image.os: Ubuntu image.release: jammy image.serial: "20221013_07:42" volatile.base_image: c68a9e1ce45aeaa74957a00f35eb4da8947ee8b00be11ad199128ff00d5e1586 volatile.eth0.hwaddr: 00:16:3e:3f:29:48 volatile.idmap.base: "0" volatile.idmap.next: '[{"Isuid":true,"Isgid":false,"Hostid":296608,"Nsid":0,"Maprange":65536},{"Isuid":false,"Isgid":true,"Hostid":296608,"Nsid":0,"Maprange":65536}]' volatile.last_state.idmap: '[{"Isuid":true,"Isgid":false,"Hostid":296608,"Nsid":0,"Maprange":65536},{"Isuid":false,"Isgid":true,"Hostid":296608,"Nsid":0,"Maprange":65536}]' volatile.last_state.power: RUNNING devices: {} ephemeral: false profiles: - default stateful: false description: "" shell> incus config get ${CONTAINER_NAME} boot.autostart false
Neuen Container von Image Server ziehen und starten
List image servers:
shell> incus remote list +-----------------+------------------------------------------+---------------+-----------+--------+--------+ | NAME | URL | PROTOCOL | AUTH TYPE | PUBLIC | STATIC | +-----------------+------------------------------------------+---------------+-----------+--------+--------+ | images | https://images.linuxcontainers.org | simplestreams | | YES | NO | +-----------------+------------------------------------------+---------------+-----------+--------+--------+ | local (default) | unix:// | incus | tls | NO | YES | +-----------------+------------------------------------------+---------------+-----------+--------+--------+ | ubuntu | https://cloud-images.ubuntu.com/releases | simplestreams | | YES | YES | +-----------------+------------------------------------------+---------------+-----------+--------+--------+ | ubuntu-daily | https://cloud-images.ubuntu.com/daily | simplestreams | | YES | YES | +-----------------+------------------------------------------+---------------+-----------+--------+--------+
List images from an image server with filters:
shell> incus image list images: debian amd64 +---------------------------+--------------+--------+----------------------------------------+--------+----------+-------------------------------+ | ALIAS | FINGERPRINT | PUBLIC | DESCRIPTION | ARCH | SIZE | UPLOAD DATE | +---------------------------+--------------+--------+----------------------------------------+--------+----------+-------------------------------+ | debian/10 (7 more) | acc938c533e4 | yes | Debian buster amd64 (20221118_05:24) | x86_64 | 75.39MB | Nov 18, 2022 at 12:00am (UTC) | +---------------------------+--------------+--------+----------------------------------------+--------+----------+-------------------------------+ | debian/10/cloud (3 more) | b3620508e8f0 | yes | Debian buster amd64 (20221118_05:25) | x86_64 | 91.67MB | Nov 18, 2022 at 12:00am (UTC) | +---------------------------+--------------+--------+----------------------------------------+--------+----------+-------------------------------+ | debian/11 (7 more) | 05ed772255b4 | yes | Debian bullseye amd64 (20221118_05:25) | x86_64 | 83.53MB | Nov 18, 2022 at 12:00am (UTC) | +---------------------------+--------------+--------+----------------------------------------+--------+----------+-------------------------------+ | debian/11/cloud (3 more) | d504a27d47e9 | yes | Debian bullseye amd64 (20221118_05:26) | x86_64 | 101.91MB | Nov 18, 2022 at 12:00am (UTC) | +---------------------------+--------------+--------+----------------------------------------+--------+----------+-------------------------------+ | debian/12 (7 more) | 75a85d176731 | yes | Debian bookworm amd64 (20221118_06:09) | x86_64 | 93.95MB | Nov 18, 2022 at 12:00am (UTC) | +---------------------------+--------------+--------+----------------------------------------+--------+----------+-------------------------------+ | debian/12/cloud (3 more) | 1c93807b372f | yes | Debian bookworm amd64 (20221118_05:24) | x86_64 | 118.75MB | Nov 18, 2022 at 12:00am (UTC) | +---------------------------+--------------+--------+----------------------------------------+--------+----------+-------------------------------+ | debian/sid (3 more) | 638d5e88fa16 | yes | Debian sid amd64 (20221118_05:26) | x86_64 | 94.91MB | Nov 18, 2022 at 12:00am (UTC) | +---------------------------+--------------+--------+----------------------------------------+--------+----------+-------------------------------+ | debian/sid/cloud (1 more) | 21ad1ca920a3 | yes | Debian sid amd64 (20221118_05:25) | x86_64 | 119.69MB | Nov 18, 2022 at 12:00am (UTC) | +---------------------------+--------------+--------+----------------------------------------+--------+----------+-------------------------------+
List available profiles:
shell> incus profile list +---------+---------+ | NAME | USED BY | +---------+---------+ | default | 4 | +---------+---------+
Launch a new Container from chosen Image:
shell> incus launch images:debian/12 debian12-template --profile=default Creating debian12-template Starting debian12-template
Container umbenennen
shell> incus stop qa-debian10-m106 shell> incus move qa-debian10-m106 qa-debian10-m106-t shell> incus start qa-debian10-m106-t shell> incus info qa-debian10-m106-t Name: qa-debian10-m106-t Remote: unix:// Architecture: x86_64 Created: 2022/11/21 16:38 UTC Status: Running Type: persistent Profiles: default ...
File von Host in Container kopieren/pushen
shell> incus file push myfile.txt mycontainer/home/ubuntu/
Wo liegen die Container rum?
# pwd /var/lib/incus/storage-pools/default/containers # ls -lad *template d--x------+ 4 root root 4.0K Nov 21 2022 debian10-template d--x------+ 4 root root 4.0K Nov 21 2022 debian11-template d--x------ 4 root root 4.0K Oct 5 2023 debian12-template d--x------+ 4 root root 4.0K Nov 21 2022 rocky8-template d--x------+ 4 root root 4.0K Nov 18 2022 rocky9-template d--x------+ 4 root root 4.0K Nov 21 2022 ubuntu2004-template d--x------+ 4 root root 4.0K Nov 18 2022 ubuntu2204-template d--x------ 4 root root 4.0K Feb 26 08:34 ubuntu2404-template