बूटेबल कंटेनर बनाने के लिए सर्वोत्तम प्रथाएँ
(developers.redhat.com)- Red Hat Enterprise Linux(RHEL) का image mode बूटेबल कंटेनरों के साथ RHEL को बनाना, deploy करना और manage करना सरल बनाता है
- डेवलपमेंट, ऑपरेशंस और solution providers एक ही container-native tools और techniques का उपयोग करके applications और आधारभूत operating system, दोनों को manage कर सकते हैं
बूटेबल कंटेनर vs. application कंटेनर बनाना
- सामान्य application कंटेनरों की तरह, Podman, Docker या buildkit जैसी मौजूदा container technologies का उपयोग करके बूटेबल कंटेनर बनाए जा सकते हैं
- images को Quay.io, Docker Hub, GitHub Container Registry या internal container registry जैसे container registries में store किया जा सकता है
- बूटेबल कंटेनर container technology का एक स्वाभाविक विकास हैं, जो पूरे operating system और Linux kernel सहित एक व्यापक container-native workflow और user experience प्रदान करते हैं
Containerfile का उपयोग
- Containerfile (जिसे Dockerfile भी कहा जाता है) में container image बनाने के लिए आवश्यक सारी जानकारी होती है, जिसमें base image, software package installation निर्देश, Git repository से files copy करना आदि शामिल हैं
- बूटेबल कंटेनर बनाने के लिए workflow और tools मूलतः application कंटेनरों जैसे ही हैं
- हालांकि, बूटेबल कंटेनर बनाते समय कुछ सर्वोत्तम प्रथाएँ लागू होती हैं
linting के लिए सर्वोत्तम प्रथाएँ
- Containerfile के अंतिम चरण के रूप में
bootc container lintकमांड चलाने की सिफारिश की जाती है - यह कमांड container image के भीतर कई checks चलाती है और समस्या होने पर error उत्पन्न करती है
- उदाहरण के लिए, यह जांचती है कि
/usr/lib/modulesमें कई kernels तो नहीं हैं,/usr/lib/bootc/kargs.dमें files का syntax जांचती है, और/etcतथा/usr/etcकी hygiene स्थिति का निरीक्षण करती है
GitHub Actions और disk space
- GitHub Actions का उपयोग करके कंटेनर बनाते समय, बूटेबल container images के आकार के कारण disk space से जुड़ी समस्याओं का सामना करना पड़ सकता है
- इन समस्याओं को हल करने के लिए, workflow file में
/opt/hostedtoolcachedirectory को हटाने वाला एक step जोड़कर disk space खाली किया जा सकता है
/var को समझना
/varpersistent और बदलने योग्य machine-local data और state के लिए directory है, और update के दौरान भी container image के/varकी contents नहीं बदलतीं- इसलिए, यदि application
/varमें data लिखती है, तो read-only mount समस्याओं से बचने के लिए उसे/usr/shareजैसी किसी दूसरी directory में स्थानांतरित करना चाहिए
useradd कमांड का उपयोग
- यदि packaging script में
useraddको call किया जाता है, तो/etc/passwdके local रूप से modify होने पर state drift हो सकता है - ऐसी समस्याओं से बचने के लिए,
systemdकेDynamicUser=yesoption का उपयोग करके dynamic user creation पर विचार किया जा सकता है - हालांकि, जटिल मामलों में
DynamicUser=yesपर switch करना कठिन हो सकता है, और ऐसे मेंsystemd-sysusersका उपयोग करके users बनाना बेहतर है
Quadlet के साथ कंटेनर एम्बेड करना
systemdमें containerized workloads चलाना विश्वसनीय deployment के लिए एक सरल लेकिन शक्तिशाली तरीका है- Podman,
systemdintegration के लिए Quadlet नामक tool प्रदान करता है, जिसके जरिए containerized workloads को declaratively manage किया जा सकता है - Quadlet, image mode के साथ पूरी तरह integrate होता है, और boot के समय application container images को pre-fetch करने के लिए logically bound images का उपयोग किया जा सकता है
सारांश
- image mode का उपयोग करने पर RHEL host के संचालन तरीके में paradigm shift आता है
- cloud-native tools का उपयोग करके operating system को बनाया, deploy और manage किया जा सकता है, और आप ऐसे immutable OS के साथ काम करते हैं जिसमें system का अधिकांश हिस्सा read-only के रूप में mount होता है
अभी कोई टिप्पणी नहीं है.