Fedora 42
Sponsored Link

Buildah : Install2025/04/25

 

Buildah इंस्टॉल करें जो कंटेनर छवियां बनाने में सहायता करता है।

विशिष्ट सेवा डेमॉन के बिना OCI @(Open Container Initiative) प्रारूप छवि बनाना संभव है।

[1] Buildah इंस्टॉल करें.
[root@dlp ~]#
dnf -y install buildah
[2] यह Buildah का मूल उपयोग है।
एक छवि से एक कार्यशील कंटेनर बनाएं।
# [fedora] छवि से एक कार्यशील कंटेनर बनाएं

[root@dlp ~]#
buildah from fedora

Resolved "fedora" as an alias (/etc/containers/registries.conf.d/000-shortnames.conf)
Trying to pull registry.fedoraproject.org/fedora:latest...
Getting image source signatures
Copying blob 0f779d0b7a52 done   |
Copying config 0e2b2f1016 done   |
Writing manifest to image destination
fedora-working-container

# कंटेनर सूची दिखाएँ

[root@dlp ~]#
buildah containers

CONTAINER ID  BUILDER  IMAGE ID     IMAGE NAME                       CONTAINER NAME
16284e1fea36     *     e5bf03515e92 registry.fedoraproject.org/fe... fedora-working-container

# कंटेनर छवि सूची दिखाएं

[root@dlp ~]#
buildah images

REPOSITORY                          TAG      IMAGE ID       CREATED        SIZE
registry.fedoraproject.org/fedora   latest             e5bf03515e92   26 hours ago     166 MB

# podman पर छवियों का उपयोग संभव है

[root@dlp ~]#
podman images

REPOSITORY                         TAG         IMAGE ID      CREATED       SIZE
registry.fedoraproject.org/fedora  latest            e5bf03515e92  26 hours ago    166 MB
[3] कार्यशील कंटेनर संचालित करें।
# शेल वैरिएबल सेट करें

[root@dlp ~]#
container=$(buildah from fedora)

[root@dlp ~]#
echo $container

fedora-working-container-1
# आदेश चलाना संभव है

[root@dlp ~]#
buildah run $container echo "Hello Buildah World"

Hello Buildah World
[root@dlp ~]#
buildah run $container bash

[root@2519755107e4 /]#
dnf -y install python3

[root@2519755107e4 /]#
[root@dlp ~]#
buildah run $container python3 -V

Python 3.13.3
[4] फ़ाइलों को वर्किंग कंटेनर में कॉपी करें।
[root@dlp ~]#
echo "buildah test" > buildah.txt

[root@dlp ~]#
buildah copy $container buildah.txt /tmp/buildah.txt

7553c62d21edda64a3067fa9805a5cd8e5781c6058be12eb9792d7e0e9781ed4
[root@dlp ~]#
buildah run $container cat /tmp/buildah.txt

buildah test
[5] वर्किंग कंटेनर का माउंट फाइल सिस्टम।
[root@dlp ~]#
buildah mount $container

/var/lib/containers/storage/overlay/4bcc3d3a2de979333d39ff8d2a79dffebda7c52195d766db542a321773843cf5/merged
[root@dlp ~]#
ll /var/lib/containers/storage/overlay/4bcc3d3a2de979333d39ff8d2a79dffebda7c52195d766db542a321773843cf5/merged

total 0
dr-xr-xr-x. 2 root root  6 Jan 16 09:00 afs
lrwxrwxrwx. 1 root root  7 Jan 16 09:00 bin -> usr/bin
dr-xr-xr-x. 2 root root  6 Jan 16 09:00 boot
drwxr-xr-x. 2 root root  6 Apr 24 15:48 dev
drwxr-xr-x. 1 root root 60 Apr 25 17:24 etc
drwxr-xr-x. 2 root root  6 Jan 16 09:00 home
.....
.....

[root@dlp ~]#
buildah umount $container

2519755107e43b1e048e5c52588a4f089a1f845bc6dba10276f61223b0d41fbb
[6] वर्किंग कंटेनर से एक कंटेनर छवि बनाएं।
[root@dlp ~]#
buildah commit $container my-fedora:latest

Getting image source signatures
Copying blob 5510a94e9f42 skipped: already exists
Copying blob 4ba0d9254dab done   |
Copying config cba8e7c8a2 done   |
Writing manifest to image destination
cba8e7c8a23a1d523690a554fedcb1a753a66a96abb196e2f56473455a0db737

[root@dlp ~]#
buildah images

REPOSITORY                          TAG      IMAGE ID       CREATED          SIZE
localhost/my-fedora                 latest   0ee32bb6225b   11 seconds ago   294 MB
registry.fedoraproject.org/fedora   latest   0e2b2f101698   17 hours ago     163 MB

[root@dlp ~]#
podman run localhost/my-fedora uname -a

Linux 33d53a671cd9 6.14.3-300.fc42.x86_64 #1 SMP PREEMPT_DYNAMIC Sun Apr 20 16:08:39 UTC 2025 x86_64 GNU/Linux
[7] निर्दिष्ट रजिस्ट्री में एक कंटेनर छवि पुश करें।
[root@dlp ~]#
buildah images

REPOSITORY                          TAG                IMAGE ID       CREATED          SIZE
localhost/my-fedora                 latest             cba8e7c8a23a   18 seconds ago   301 MB
registry.fedoraproject.org/fedora   latest             e5bf03515e92   26 hours ago     166 MB

# [localhost/my-fedora] छवि को [node01.srv.world:5000] रजिस्ट्री पर धकेलें
# यदि लक्ष्य रजिस्ट्री SSL/TLS पर नहीं है, तो [--tls-verify=false] विकल्प की आवश्यकता है

[root@dlp ~]#
buildah push --tls-verify=false localhost/my-fedora node01.srv.world:5000/my-fedora

Getting image source signatures
Copying blob 92e30f8057f2 done   |
Copying blob dccf7e89f659 done   |
Copying config 0ee32bb622 done   |
Writing manifest to image destination

[root@dlp ~]#
curl node01.srv.world:5000/v2/_catalog

{"repositories":["my-fedora"]}
# अन्य नोड्स से खींचना संभव है

[root@node01 ~]#
podman pull --tls-verify=false node01.srv.world:5000/my-fedora

[root@node01 ~]#
podman images

REPOSITORY                       TAG         IMAGE ID      CREATED        SIZE
node01.srv.world:5000/my-fedora  latest      cba8e7c8a23a  9 minutes ago  294 MB
मिलान सामग्री