Buildah : Install2025/11/12 |
|
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 4f417555f8f8 done | Copying config a9005aba99 done | Writing manifest to image destination fedora-working-container # कंटेनर सूची दिखाएँ [root@dlp ~]# buildah containers CONTAINER ID BUILDER IMAGE ID IMAGE NAME CONTAINER NAME 85736a261f93 * a9005aba99b1 registry.fedoraproject.org/fe... fedora-working-container # कंटेनर छवि सूची दिखाएं [root@dlp ~]# buildah images REPOSITORY TAG IMAGE ID CREATED SIZE registry.fedoraproject.org/fedora latest a9005aba99b1 2 days ago 186 MB # podman पर छवियों का उपयोग संभव है [root@dlp ~]# podman images REPOSITORY TAG IMAGE ID CREATED SIZE registry.fedoraproject.org/fedora latest a9005aba99b1 2 days ago 186 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 bash-5.3# dnf -y install python3 bash-5.3# [root@dlp ~]# buildah run $container python3 -V Python 3.14.0 |
| [4] | फ़ाइलों को वर्किंग कंटेनर में कॉपी करें। |
|
[root@dlp ~]# echo "buildah test" > buildah.txt [root@dlp ~]# buildah copy $container buildah.txt /tmp/buildah.txt 28ca540e3c2895a1cea4aeff57f0f554662c11fc58c6f51a1e237521c813764e[root@dlp ~]# buildah run $container cat /tmp/buildah.txt buildah test |
| [5] | वर्किंग कंटेनर का माउंट फाइल सिस्टम। |
|
[root@dlp ~]# buildah mount $container /var/lib/containers/storage/overlay/11e58a21ba740def8da76dec0727529e64853a9af09d50d901e2d15ea0caf31a/merged[root@dlp ~]# ll /var/lib/containers/storage/overlay/11e58a21ba740def8da76dec0727529e64853a9af09d50d901e2d15ea0caf31a/merged total 0 dr-xr-xr-x. 2 root root 6 Jul 30 09:00 afs lrwxrwxrwx. 1 root root 7 Jul 30 09:00 bin -> usr/bin dr-xr-xr-x. 2 root root 6 Jul 30 09:00 boot drwxr-xr-x. 1 root root 6 Nov 9 15:47 dev drwxr-xr-x. 1 root root 25 Nov 12 10:08 etc drwxr-xr-x. 2 root root 6 Jul 30 09:00 home ..... .....[root@dlp ~]# buildah umount $container 168fc77d5d6aa8f2ada63a672c466a54334c32794042ac325d721f2930389eec |
| [6] | वर्किंग कंटेनर से एक कंटेनर छवि बनाएं। |
|
[root@dlp ~]# buildah commit $container my-fedora:latest Getting image source signatures Copying blob f37e4c50fba3 skipped: already exists Copying blob 6ec9c48c5cee done | Copying config d9e0d86542 done | Writing manifest to image destination d9e0d86542aa4219ff2634d79d172f8477f1d0579df02f6e2644cc3f9f64f5c9[root@dlp ~]# buildah images REPOSITORY TAG IMAGE ID CREATED SIZE localhost/my-fedora latest d9e0d86542aa 19 seconds ago 325 MB registry.fedoraproject.org/fedora latest a9005aba99b1 2 days ago 186 MB[root@dlp ~]# podman run localhost/my-fedora cat /etc/os-release NAME="Fedora Linux" VERSION="43 (Container Image)" RELEASE_TYPE=stable ID=fedora VERSION_ID=43 VERSION_CODENAME="" PRETTY_NAME="Fedora Linux 43 (Container Image)" ..... ..... |
| [7] | निर्दिष्ट रजिस्ट्री में एक कंटेनर छवि पुश करें। |
|
[root@dlp ~]# buildah images REPOSITORY TAG IMAGE ID CREATED SIZE localhost/my-fedora latest d9e0d86542aa About a minute ago 325 MB registry.fedoraproject.org/fedora latest a9005aba99b1 2 days ago 186 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 |
| Sponsored Link |
|
|