[2] Tworzenie obrazów ze źródła
6 sierpnia 2020Stworzymy obraz kontenera z pustego obrazu kontenera.
[1] Rozpocznij tworzenie z pustym obrazem.
# stwórz pusty kontener ze źródła [scratch] [root@lsr01vm ~]# newcontainer=$(buildah from scratch) [root@lsr01vm ~]# buildah containers CONTAINER ID BUILDER IMAGE ID IMAGE NAME CONTAINER NAME d75ca7e5dc8b * 831691599b88 docker.io/library/centos:latest centos-working-container 38b7e6085482 * 831691599b88 docker.io/library/centos:latest centos-working-container-1 e900c96c5283 * scratch working-container # zamontuj pusty kontener [scratch] [root@lsr01vm ~]# scratchmnt=$(buildah mount $newcontainer) [root@lsr01vm ~]# echo $scratchmnt /var/lib/containers/storage/overlay/e52945c84699cb66e67e33d0fcd2bcf48bb042dbb4e3de6487e26cf941bb623d/merged # zainstaluj paczki do pustego kontenera [scratch] [root@lsr01vm ~]# dnf -y group install "Minimal Install" --releasever=8 --installroot=$scratchmnt # odmontuj go [root@lsr01vm ~]# buildah umount $newcontainer e900c96c5283874cb5bdb4d7a204c08cb168d1ade2fee5439cd67684dd8e84d7 # uruchom kontener [root@lsr01vm ~]# buildah run $newcontainer bash [root@e900c96c5283 /]# [root@e900c96c5283 /]# ls bin boot dev etc home lib lib64 media mnt opt proc root run sbin srv sys tmp usr var [root@e900c96c5283 /]# uname -a Linux e900c96c5283 4.18.0-193.6.3.el8_2.x86_64 #1 SMP Wed Jun 10 11:09:32 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux [root@e900c96c5283 /]# exit exit [root@lsr01vm ~]# # dodaj obraz [root@lsr01vm ~]# buildah commit $newcontainer centos-minimum:latest Getting image source signatures Copying blob d65fece330bb done Copying config 3d3d8fb693 done Writing manifest to image destination Storing signatures 3d3d8fb693cef350958d6532414fa859f9afb967f782149368cf9e114072b455 [root@lsr01vm ~]# buildah images REPOSITORY TAG IMAGE ID CREATED SIZE localhost/centos-minimum latest 3d3d8fb693ce 4 minutes ago 1.36 GB docker.io/library/centos latest 831691599b88 7 weeks ago 223 MB