Manipulare si creare imagini in LXD
Postat la Mon 28 May 2018 in tutoriale, lxd, lxc
Containerele LXD folosesc pentru start imagini preconfigurate din repository externe sau locale. Surse principale de imagini de boot sunt linuxcontainers.org si Ubuntu.
Aceste surse sunt numite remote in LXD:
lxc remote list
+-----------------+------------------------------------------+---------------+-----------+--------+--------+
| NAME | URL | PROTOCOL | AUTH TYPE | PUBLIC | STATIC |
+-----------------+------------------------------------------+---------------+-----------+--------+--------+
| images | https://images.linuxcontainers.org | simplestreams | | YES | NO |
+-----------------+------------------------------------------+---------------+-----------+--------+--------+
| local (default) | unix:// | lxd | tls | NO | YES |
+-----------------+------------------------------------------+---------------+-----------+--------+--------+
| ubuntu | https://cloud-images.ubuntu.com/releases | simplestreams | | YES | YES |
+-----------------+------------------------------------------+---------------+-----------+--------+--------+
| ubuntu-daily | https://cloud-images.ubuntu.com/daily | simplestreams | | YES | YES |
+-----------------+------------------------------------------+---------------+-----------+--------+--------+
Imaginile diponibile in aceste surse pot fi listate sau cautate facil:
lxc image list images:
lxc image list images:debian
La lansarea unui container folosind o imagine remote aceasta este salvata si local si de obicei este actualizata zilnic.
lxc image list
+-------+--------------+--------+---------------------------------------+--------+----------+------------------------------+
| ALIAS | FINGERPRINT | PUBLIC | DESCRIPTION | ARCH | SIZE | UPLOAD DATE |
+-------+--------------+--------+---------------------------------------+--------+----------+------------------------------+
| | d071fb38b248 | no | Debian stretch amd64 (20180527_05:25) | x86_64 | 110.20MB | May 27, 2018 at 9:40am (UTC) |
+-------+--------------+--------+---------------------------------------+--------+----------+------------------------------+
Informatii detaliate putem afla:
lxc image info d071fb38b248
Fingerprint: d071fb38b248d1a6004a98490b3bd028322678f71deddc3ed2eef3324a54a46d
Size: 110.20MB
Architecture: x86_64
Public: no
Timestamps:
Created: 2018/05/27 00:00 UTC
Uploaded: 2018/05/27 09:40 UTC
Expires: never
Last used: 2018/05/19 14:25 UTC
Properties:
serial: 20180527_05:25
architecture: amd64
description: Debian stretch amd64 (20180527_05:25)
os: Debian
release: stretch
Aliases:
Cached: yes
Auto update: enabled
Source:
Server: https://images.linuxcontainers.org
Protocol: simplestreams
Alias: debian/9
Putem importa imagini local pentru o utilizare ulterioara.
lxc image copy ubuntu:16.04 local: --alias my-ubuntu
In mod obisnuit se doreste crearea unei imagini personalizate ce sa includa diverse pachete pornind de la o imagine oficiala. Acest lucru poate fi obtinut:
lxc launch images:debian/9 my-container
lxc exec my-container bash
<modifcam ce dorim>
lxc publish my-container --alias my-debian
Cand ulterior dorim sa pornim un container folosind imaginea creata:
lxc launch my-debian g22
Imaginile proprii pot fi facute accesibile fie printr-un serviciu LXD accesibil in retea sau server web. Pentru acest lucru va rog folositi documentatia oficiala
Articolul face parte din seria Virtualizare cu LXD