介绍
有完整独立内核的容器,可部署到物理机 支持ISO, raw or qcow2 https://containers.github.io/bootc/intro.html
https://docs.fedoraproject.org/en-US/bootc/getting-started
镜像准备
0 1 2 3 4 |
podman pull quay.io/fedora/fedora-bootc:41 podman tag quay.io/fedora/fedora-bootc:41 registry.hylstudio.local/quay.io/fedora/fedora-bootc:41 podman push registry.hylstudio.local/quay.io/fedora/fedora-bootc:41 |
用podman
0 1 2 3 4 5 6 7 8 9 |
FROM registry.hylstudio.local/quay.io/fedora/fedora-bootc:41 RUN dnf install -y git vim tmux && dnf clean all RUN echo 'bootc' > /etc/hostname \ && echo 'hyl ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers.d/passwordless-sudo \ && echo '[[registry]]' >> /etc/containers/registries.conf.d/hylstudio.conf \ && echo 'location = "registry.hylstudio.local"' >> /etc/containers/registries.conf.d/hylstudio.conf \ && echo 'insecure = true' >> /etc/containers/registries.conf.d/hylstudio.conf \ && echo 'sudo dmesg -D' >> /etc/profile RUN bootc container lint |
打镜像
0 1 2 |
podman build --add-host 'registry.hylstudio.local:192.168.0.3' -t registry.hylstudio.local/fedora-bootc/test:$TAG . |
转ISO
镜像需要转成iSO才能安装到物理机和虚机
配置文件准备
config.json
0 1 2 3 4 5 6 7 8 9 10 11 12 13 |
{ "customizations": { "user": [ { "name": "hyl", "password": "123456", "groups": [ ] } ] } } |
需要的镜像准备
0 1 2 3 4 5 6 7 8 |
podman pull quay.io/centos-bootc/bootc-image-builder:latest podman tag quay.io/centos-bootc/bootc-image-builder:latest registry.hylstudio.local/quay.io/centos-bootc/bootc-image-builder:latest podman push registry.hylstudio.local/quay.io/centos-bootc/bootc-image-builder:latest docker pull quay.io/centos-bootc/bootc-image-builder:latest docker tag quay.io/centos-bootc/bootc-image-builder:latest registry.hylstudio.local/quay.io/centos-bootc/bootc-image-builder:latest docker push registry.hylstudio.local/quay.io/centos-bootc/bootc-image-builder:latest |
windows
安装podman desktop后可用UI插件,需要root
0 1 2 3 4 |
podman machine stop podman machine set --rootful podman machine start |
对应的命令行
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
podman ` run ` --rm ` --tty ` --privileged ` --security-opt label=type:unconfined_t ` -v /var/lib/containers/storage:/var/lib/containers/storage ` -v E:\HYL\Desktop\1:/output/ ` -v E:\HYL\Desktop\1\config.json:/config.json:ro ` --label bootc.image.builder=true ` registry.hylstudio.local/quay.io/centos-bootc/bootc-image-builder:latest ` registry.hylstudio.local/fedora-bootc/test:2024122801 ` --output /output/ ` --local ` --type anaconda-iso ` --target-arch amd64 ` --rootfs ext4 |
linux
执行镜像转换
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
podman \ run \ --rm \ --tty \ --privileged \ --security-opt label=type:unconfined_t \ -v /var/lib/containers/storage:/var/lib/containers/storage \ -v /data/bootc/:/output/ \ -v /data/bootc/config.json:/config.json:ro \ --label bootc.image.builder=true \ registry.hylstudio.local/quay.io/centos-bootc/bootc-image-builder:latest \ registry.hylstudio.local/fedora-bootc/test:$TAG \ --output /output/ \ --local \ --type anaconda-iso \ --target-arch amd64 \ --rootfs ext4 |
ubuntu 24.04上有bug
转镜像报错1
/etc/containers/storage.conf
0 1 2 3 4 5 |
[storage] driver = "overlay" runroot = "/run/containers/storage" graphroot = "/var/lib/containers/storage" |
命令行修改/etc/containers/storage.conf
0 1 2 3 4 |
sudo rm -rf /var/lib/containers/storage sudo mkdir -p /etc/containers echo -e "[storage]\ndriver = \"overlay\"\nrunroot = \"/run/containers/storage\"\ngraphroot = \"/var/lib/containers/storage\"" | sudo tee /etc/containers/storage.conf |
转镜像报错2
0 1 |
grub2-probe: error: failed to get canonical path of `/dev/mapper/ubuntu--vg-ubuntu--lv' |
安装到虚机/物理机
安装
0 1 2 |
scp ubuntu@192.168.0.16:/data/bootc/bootiso/install.iso fedora-bootc-test-2024122801.iso |
同其他系统,略
升级系统
0 1 2 3 |
bootc upgrade bootc switch registry.hylstudio.local/fedora-bootc/test:2024122802 |
参考
- https://docs.fedoraproject.org/en-US/bootc/storage/
- https://github.com/osbuild/bootc-image-builder/issues/446
- https://github.com/coreos/fedora-coreos-tracker/issues/220
- https://forum.level1techs.com/t/fedora-22-disable-dmesg-output-in-console-ttys/81928
- https://docs.fedoraproject.org/en-US/bootc/getting-started/#_conversion_to_disk_images
0 Comments