Stéphane Graber descreveu o procedimento para criar imagens para o LXD 2.0 e acima do zero no artigo LXD 2.0: Gerenciamento de imagens (seção " Construindo manualmente uma imagem "):
Manually building an image
Building your own image is also pretty simple.
- Generate a container filesystem. This entirely depends on the distribution you’re using. For Ubuntu and Debian, it would be by using
debootstrap
.- Configure anything that’s needed for the distribution to work properly in a container (if anything is needed).
- Make a tarball of that container filesystem, optionally compress it.
- Write a new
metadata.yaml
file based on the one described above.- Create another tarball containing that
metadata.yaml
file.Import those two tarballs as a LXD image with:
lxc image import <metadata tarball> <rootfs tarball> --alias some-name
You will probably need to go through this a few times before everything works, tweaking things here and there, possibly adding some templates and properties.
O arquivo metadata.yaml
deve conter pelo menos os dois pares de chave / valor a seguir (substitua i686
pela arquitetura do sistema correta e 1458040200
pelo registro de data e hora no formato Unix epoch (por exemplo, date +%s
):
architecture: "i686"
creation_date: 1458040200
Mais informações sobre o metadata.yaml
podem ser encontradas no artigo acima (seção "Metadados da imagem" ).