distrobuilder

最後更新: 2024-02-08

目錄

  • rootfs.tar.xz & meta.tar.xz 由來
  • Download container image
  • Import image

 


rootfs.tar.xz & meta.tar.xz 由來

 

它們是由 distrobuilder 根據 Config file (YAML) 建立 (ie. ubuntu.yaml)
(distrobuilder - System container image builder for LXC and LXD)

i.e.

# Args: build-dir | build-lxc | build-lxd

# https://github.com/lxc/distrobuilder/tree/master/doc/examples

distrobuilder build-lxc /usr/share/distrobuilder/ubuntu.yaml

Note: Install distrobuilder on U22

  1. apt install snapd
  2. snap install distrobuilder

 


Download container

 

Image 檔包含: rootfs.tar.xz & meta.tar.xz

# This domain hosts a public image server for use by LXC

Link:

Image 的資料

它是用 distrobuilder 每天去建立 Image 的
(distrobuilder written in Go, config with YAML)

直接下載 template

LINK="https://jenkins.linuxcontainers.org/job"

OS="image-rockylinux/lastStableBuild/architecture=amd64,release=8,variant=default/artifact"

wget $LINK/$OS/{rootfs.tar.xz,meta.tar.xz}

 

 


Import image(rootfs.tar.xz & meta.tar.xz)

 

 

# -m | --metadata         # Path to the metadata for the image.

# -f | --fstree                # Path to the filesystem tree for the image.

# local - /usr/share/lxc/templates/lxc-local (Package: liblxc-common)

lxc-create c1 -t local -- -m meta.tar.xz -f rootfs.tar.xz    # U22 's rootfs.tar.xz & meta.tar.xz

Unpacking the rootfs

---
You just created an Ubuntu focal amd64 (20230114_07:43) container.

To enable SSH, run: apt install openssh-server
No default root or user password are set by LXC.

P.S. Arguments

  • --name <string>
  • --path <path>
  • --rootfs <rootfs>
  • --mapped-uid <map>
  • --mapped-gid <map>

i.e.

lxc-create tools -t local -- -m meta.tar.xz -f rootfs.tar.xz --path /lxc/tools

 


 

Creative Commons license icon Creative Commons license icon