{"id":38785,"date":"2019-10-31T22:25:55","date_gmt":"2019-10-31T19:25:55","guid":{"rendered":"https:\/\/prohoster.info\/blog\/rekomendatsii-po-zapusku-buildah-vnutri-kontejnera\/"},"modified":"2019-10-31T22:25:55","modified_gmt":"2019-10-31T19:25:55","slug":"rekomendatsii-po-zapusku-buildah-vnutri-kontejnera","status":"publish","type":"post","link":"https:\/\/prohoster.info\/hu\/blog\/administrirovanie\/rekomendatsii-po-zapusku-buildah-vnutri-kontejnera","title":{"rendered":"Aj\u00e1nl\u00e1sok a Buildah ind\u00edt\u00e1s\u00e1hoz kont\u00e9neren bel\u00fcl","gt_translate_keys":[{"key":"rendered","format":"text"}]},"content":{"rendered":"<p>Mi\u00e9rt \u00e9rdemes a kont\u00e9neres v\u00e9grehajt\u00e1si k\u00f6rnyezetek k\u00fcl\u00f6n eszk\u00f6z\u00f6kre bontani? K\u00fcl\u00f6n\u00f6sen az\u00e9rt, mert ezeket az eszk\u00f6z\u00f6ket kombin\u00e1lni lehet, hogy v\u00e9dj\u00e9k egym\u00e1st.<\/p>\n<p><img decoding=\"async\" alt=\"Aj\u00e1nl\u00e1sok a Buildah ind\u00edt\u00e1s\u00e1hoz kont\u00e9neren bel\u00fcl\" src=\"\/wp-content\/uploads\/2019\/10\/f8b21da6a59e461effbe3ee27c07012c.png\" style=\"display:block;margin: 0 auto;\" \/><br \/>\n<br \/>\nSokan vonz\u00f3nak tal\u00e1lj\u00e1k a kont\u00e9neres OCI-k\u00e9pek \u00f6ssze\u00e1ll\u00edt\u00e1s\u00e1nak \u00f6tlet\u00e9t a <noindex><a rel=\"nofollow\" href=\"https:\/\/kubernetes.io\/\">Kubernetes<\/a><\/noindex> vagy hasonl\u00f3 rendszeren bel\u00fcl. Tegy\u00fck fel, hogy van egy CI\/CD rendszer\u00fcnk, amely folyamatosan \u00f6ssze\u00e1ll\u00edtja a k\u00e9peket, akkor valami ilyesmi <noindex><a rel=\"nofollow\" href=\"https:\/\/developers.redhat.com\/openshift\/\">Red Hat OpenShift<\/a><\/noindex>\/Kubernetes \u0431\u044b\u043b\u043e \u0431\u044b \u0432\u0435\u0441\u044c\u043c\u0430 \u043f\u043e\u043b\u0435\u0437\u043d\u043e \u0441 \u0442\u043e\u0447\u043a\u0438 \u0437\u0440\u0435\u043d\u0438\u044f \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u043f\u0440\u0438 \u0441\u0431\u043e\u0440\u043a\u0435. \u0414\u043e \u043d\u0435\u0434\u0430\u0432\u043d\u0438\u0445 \u043f\u043e\u0440 \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u043e \u043b\u044e\u0434\u0435\u0439 \u043f\u0440\u043e\u0441\u0442\u043e \u0434\u0430\u0432\u0430\u043b\u0438 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0430\u043c \u0434\u043e\u0441\u0442\u0443\u043f \u043a Docker-\u0441\u043e\u043a\u0435\u0442\u0443 \u0438 \u0440\u0430\u0437\u0440\u0435\u0448\u0430\u043b\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u043a\u043e\u043c\u0430\u043d\u0434\u0443 docker build. <noindex><a rel=\"nofollow\" href=\"https:\/\/www.projectatomic.io\/blog\/2015\/08\/why-we-dont-let-non-root-users-run-docker-in-centos-fedora-or-rhel\/\">M\u00e1r n\u00e9h\u00e1ny \u00e9vvel ezel\u0151tt bemutattuk,<\/a><\/noindex>, hogy ez nagyon nem biztons\u00e1gos, val\u00f3j\u00e1ban ez m\u00e9g rosszabb, mint jelsz\u00f3 n\u00e9lk\u00fcli root vagy sudo megad\u00e1sa.<br \/>\n<noindex><a rel=\"nofollow\" name=\"habracut\"><\/a><\/noindex><br \/>\nEz\u00e9rt az emberek folyamatosan pr\u00f3b\u00e1lnak Buildah-t futtatni egy kont\u00e9nerben. R\u00f6viden, l\u00e9trehoztuk <noindex><a rel=\"nofollow\" href=\"https:\/\/github.com\/containers\/Demos\/tree\/master\/running\/BuildahInPodman\">p\u00e9ld\u00e1m<\/a><\/noindex> annak \u00e9rdek\u00e9ben, hogy szerint\u00fcnk a legjobban fussanak a Buildah kont\u00e9nereken bel\u00fcl, \u00e9s k\u00f6zz\u00e9tett\u00fck a megfelel\u0151 k\u00e9peket a <noindex><a rel=\"nofollow\" href=\"https:\/\/quay.io\/buildah\">quay.io\/buildah<\/a><\/noindex>. Kezdj\u00fck\u2026<\/p>\n<h3>Be\u00e1ll\u00edt\u00e1s<\/h3>\n<p>\nEzek a k\u00e9pek Dockerfile-okb\u00f3l k\u00e9sz\u00fcltek, amelyeket megtal\u00e1lhat a Buildah t\u00e1rol\u00f3j\u00e1ban a <noindex><a rel=\"nofollow\" href=\"https:\/\/github.com\/containers\/buildah\/tree\/master\/contrib\/buildahimage\">buildahimage<\/a><\/noindex>.<br \/>\nItt megvizsg\u00e1ljuk <noindex><a rel=\"nofollow\" href=\"https:\/\/github.com\/containers\/buildah\/blob\/master\/buildahimage\/stable\/Dockerfile\">a Dockerfile stabil verzi\u00f3j\u00e1t.<\/a><\/noindex>.<\/p>\n<pre><code class=\"plaintext\"># stable\/Dockerfile\n#\n# Build a Buildah container image from the latest\n# stable version of Buildah on the Fedoras Updates System.\n# https:\/\/bodhi.fedoraproject.org\/updates\/?search=buildah\n# This image can be used to create a secured container\n# that runs safely with privileges within the container.\n#\nFROM fedora:latest\n\n# Don't include container-selinux and remove\n# directories used by dnf that are just taking\n# up space.\nRUN yum -y install buildah fuse-overlayfs --exclude container-selinux; rm -rf \/var\/cache \/var\/log\/dnf* \/var\/log\/yum.*\n\n# Adjust storage.conf to enable Fuse storage.\nRUN sed -i -e 's|^#mount_program|mount_program|g' -e '\/additionalimage.*\/a \"\/var\/lib\/shared\",' \/etc\/containers\/storage.conf\n<\/code><\/pre>\n<p>\nA gazda Linux-kernele \u00e1ltal val\u00f3s\u00edtott OverlayFS helyett a kont\u00e9neren bel\u00fcl a <noindex><a rel=\"nofollow\" href=\"https:\/\/github.com\/containers\/fuse-overlayfs\">fuse-overlay<\/a><\/noindex>programot haszn\u00e1ljuk, mivel jelenleg az OverlayFS csak akkor k\u00e9pes a csatlakoztat\u00e1sra, ha SYS_ADMIN jogokkal rendelkezik a Linux capabilities seg\u00edts\u00e9g\u00e9vel. Mi viszont szeretn\u00e9nk futtatni a Buildah kont\u00e9nereinket root szint\u0171 jogosults\u00e1gok n\u00e9lk\u00fcl. A Fuse-overlay meglehet\u0151sen gyorsan m\u0171k\u00f6dik, \u00e9s teljes\u00edtm\u00e9nyben jobb, mint a VFS t\u00e1rol\u00f3meghajt\u00f3. Vegye figyelembe, hogy a Fuse-t haszn\u00e1l\u00f3 Buildah-kont\u00e9ner ind\u00edt\u00e1sakor meg kell adni a \/dev\/fuse eszk\u00f6zt.<\/p>\n<pre><code class=\"plaintext\">podman run --device \/dev\/fuse quay.io\/buildahctr ...\nRUN mkdir -p \/var\/lib\/shared\/overlay-images \/var\/lib\/shared\/overlay-layers; touch \/var\/lib\/shared\/overlay-images\/images.lock; touch \/var\/lib\/shared\/overlay-layers\/layers.lock\n<\/code><\/pre>\n<p>\nEzut\u00e1n l\u00e9trehozunk egy k\u00f6nyvt\u00e1rat az extra t\u00e1rol\u00f3k sz\u00e1m\u00e1ra. <noindex><a rel=\"nofollow\" href=\"https:\/\/github.com\/containers\/storage\">Container\/storage<\/a><\/noindex> t\u00e1mogatja a kieg\u00e9sz\u00edt\u0151, csak olvashat\u00f3 t\u00e1rol\u00f3k csatlakoztat\u00e1s\u00e1nak koncepci\u00f3j\u00e1t. P\u00e9ld\u00e1ul be\u00e1ll\u00edthatunk egy overlay t\u00e1rol\u00f3ter\u00fcletet egy g\u00e9pen, majd az NFS seg\u00edts\u00e9g\u00e9vel ezt a t\u00e1rol\u00f3t egy m\u00e1sik g\u00e9pre csatlakoztathatjuk, \u00e9s a k\u00e9peket let\u00f6lt\u00e9s n\u00e9lk\u00fcl haszn\u00e1lhatjuk bel\u0151le. Erre a t\u00e1rol\u00f3ra sz\u00fcks\u00e9g\u00fcnk van, hogy lehet\u0151s\u00e9g\u00fcnk legyen csatlakoztatni valamilyen t\u00e1rol\u00f3t a gazd\u00e1n, \u00e9s azt haszn\u00e1lni a kont\u00e9neren bel\u00fcl.<\/p>\n<pre><code class=\"plaintext\"># Set up environment variables to note that this is\n# not starting with user namespace and default to\n# isolate the filesystem with chroot.\nENV _BUILDAH_STARTED_IN_USERNS=\"\" BUILDAH_ISOLATION=chroot\n<\/code><\/pre>\n<p>\nV\u00e9g\u00fcl, a BUILDAH_ISOLATION k\u00f6rnyezeti v\u00e1ltoz\u00f3 haszn\u00e1lat\u00e1val jelezz\u00fck, hogy alap\u00e9rtelmez\u00e9s szerint a Buildah-kont\u00e9ner chroot izol\u00e1ci\u00f3val kell, hogy fusson. Tov\u00e1bbi izol\u00e1ci\u00f3ra itt nincs sz\u00fcks\u00e9g, mivel m\u00e1r egy kont\u00e9nerben dolgozunk. Ahhoz, hogy a Buildah saj\u00e1t n\u00e9vt\u00e9rrel rendelkez\u0151 kont\u00e9nereket hozzon l\u00e9tre, SYS_ADMIN kiv\u00e1lts\u00e1g sz\u00fcks\u00e9ges, amihez le kell bontani a SELinux \u00e9s SECCOMP szab\u00e1lyokat a kont\u00e9ner sz\u00e1m\u00e1ra, ami ellentmond a biztons\u00e1gos kont\u00e9nerb\u0151l t\u00f6rt\u00e9n\u0151 \u00e9p\u00edt\u00e9si telep\u00edt\u00e9s\u00fcnknek.<\/p>\n<h3>Buildah ind\u00edt\u00e1sa kont\u00e9neren bel\u00fcl<\/h3>\n<p>\nA fenti Buildah-kont\u00e9ner k\u00e9p architekt\u00far\u00e1ja rugalmas vari\u00e1l\u00e1si lehet\u0151s\u00e9geket biztos\u00edt a kont\u00e9nerek ind\u00edt\u00e1s\u00e1hoz.<\/p>\n<h4>Sebess\u00e9g vs. biztons\u00e1g<\/h4>\n<p>\nA sz\u00e1m\u00edt\u00f3g\u00e9pes biztons\u00e1g mindig a folyamat v\u00e9grehajt\u00e1si sebess\u00e9ge \u00e9s a k\u00f6r\u00fcl\u00f6tte l\u00e9v\u0151 v\u00e9delem mennyis\u00e9g\u00e9nek kompromisszuma. Ez az \u00e1ll\u00edt\u00e1s a kont\u00e9nerek \u00e9p\u00edt\u00e9sekor is igaz, ez\u00e9rt lentebb megvizsg\u00e1ljuk az ilyen kompromisszumok lehet\u0151s\u00e9geit.<\/p>\n<p>A fent t\u00e1rgyalt kont\u00e9nerk\u00e9p a t\u00e1rol\u00e1s\u00e1t a \/var\/lib\/containers helyen fogja t\u00e1rolni. \u00cdgy a tartalom csatol\u00e1sa erre a k\u00f6nyvt\u00e1rra nemcsak sz\u00fcks\u00e9ges, hanem jelent\u0151sen befoly\u00e1solja a kont\u00e9nerek k\u00e9peinek \u00e9p\u00edt\u00e9si sebess\u00e9g\u00e9t is.<\/p>\n<p>H\u00e1rom lehet\u0151s\u00e9get vizsg\u00e1lunk.<\/p>\n<p><b>1. lehet\u0151s\u00e9g.<\/b> Ha maxim\u00e1lis biztons\u00e1gra van sz\u00fcks\u00e9g, akkor minden kont\u00e9nerhez k\u00fcl\u00f6n mapp\u00e1t hozhatunk l\u00e9tre a containers\/image sz\u00e1m\u00e1ra, \u00e9s azt volume-mount-on kereszt\u00fcl csatlakoztathatjuk a kont\u00e9nerhez. Ezen k\u00edv\u00fcl a context directory-t mag\u00e1ban a kont\u00e9nerben, a \/build mapp\u00e1ban kell elhelyezni:<\/p>\n<pre><code class=\"plaintext\"># mkdir \/var\/lib\/containers1\n# podman run -v .\/build:\/build:z -v \/var\/lib\/containers1:\/var\/lib\/containers:Z quay.io\/buildah\/stable\nbuildah  -t image1 bud \/build\n# podman run -v \/var\/lib\/containers1:\/var\/lib\/containers:Z quay.io\/buildah\/stable buildah  push  image1 registry.company.com\/myuser\n# rm -rf \/var\/lib\/containers1\n<\/code><\/pre>\n<p>\n<i>Biztons\u00e1g.<\/i> A Buildah running in such a container has maximum security: it is not granted any root privileges via capabilities, and all SECOMP and SELinux restrictions apply to it. Such a container can even be launched with User Namespace isolation by adding an option like --uidmap 0:100000:10000.<\/p>\n<p><i>Teljes\u00edtm\u00e9ny.<\/i> A teljes\u00edtm\u00e9ny viszont minim\u00e1lis, mivel a kont\u00e9neregisztr\u00e1k b\u00e1rmely k\u00e9pe minden alkalommal a hosztra ker\u00fcl \u00e1tm\u00e1sol\u00e1sra, \u00e9s a cache-el\u00e9s sz\u00f3 szerint \u201enem m\u0171k\u00f6dik\u201d. A Buildah-kont\u00e9ner befejez\u00e9se ut\u00e1n a k\u00e9pet felt\u00f6lti a regiszterbe, \u00e9s megsemmis\u00edti a tartalmat a hoszton. Amikor a k\u00f6vetkez\u0151 alkalommal a kont\u00e9nerk\u00e9p \u00e9p\u00fcl, \u00fajra le kell t\u00f6lteni a regiszterb\u0151l, mivel a hoszton addigra m\u00e1r semmi nem marad.<\/p>\n<p><b>2. lehet\u0151s\u00e9g.<\/b> Ha Docker szint\u0171 teljes\u00edtm\u00e9nyre van sz\u00fcks\u00e9ged, akkor a gazdag\u00e9p container\/storage k\u00f6nyvt\u00e1r\u00e1t k\u00f6zvetlen\u00fcl a kont\u00e9nerhez csatolhatod.<\/p>\n<pre><code class=\"plaintext\"># podman run -v .\/build:\/build:z -v \/var\/lib\/containers:\/var\/lib\/containers --security-opt label:disabled quay.io\/buildah\/stable buildah  -t image2 bud \/build\n# podman run -v \/var\/lib\/containers:\/var\/lib\/containers --security-opt label:disabled  quay.io\/buildah\/stable buildah push image2 registry.company.com\/myuser\n<\/code><\/pre>\n<p>\n<i>Biztons\u00e1g.<\/i> Ez a kont\u00e9nerek \u00e9p\u00edt\u00e9s\u00e9nek legkev\u00e9sb\u00e9 biztons\u00e1gos m\u00f3dja, mivel itt a kont\u00e9ner sz\u00e1m\u00e1ra enged\u00e9lyezett, hogy m\u00f3dos\u00edtsa a gazdag\u00e9pen tal\u00e1lhat\u00f3 t\u00e1rol\u00f3t, \u00e9s potenci\u00e1lisan rosszindulat\u00fa k\u00e9pet juttathat a Podmanhoz vagy a CRI-O-hoz. Ezen k\u00edv\u00fcl ki kell kapcsolni a SELinux elv\u00e1laszt\u00e1st, hogy a Buildah-kont\u00e9nerben tal\u00e1lhat\u00f3 folyamatok interakci\u00f3ba l\u00e9phessenek a gazdag\u00e9p t\u00e1rol\u00f3j\u00e1val. \u00c9rdemes megjegyezni, hogy ez a lehet\u0151s\u00e9g m\u00e9g mindig jobb, mint a Docker socket, mivel a kont\u00e9ner blokkolva van a fennmarad\u00f3 biztons\u00e1gi funkci\u00f3kkal, \u00e9s nem k\u00e9pes csak \u00fagy elind\u00edtani b\u00e1rmilyen kont\u00e9nert a gazdag\u00e9pen.<\/p>\n<p><i>Teljes\u00edtm\u00e9ny.<\/i> Itt maxim\u00e1lis, mivel a gyors\u00edt\u00f3t\u00e1r teljesen ki van haszn\u00e1lva. Ha a Podman vagy a CRI-O m\u00e1r let\u00f6lt\u00f6tte a sz\u00fcks\u00e9ges k\u00e9pet a gazdag\u00e9pre, akkor a Buildah-folyamatnak a kont\u00e9neren bel\u00fcl nem kell \u00fajra let\u00f6ltenie, \u00e9s a k\u00e9s\u0151bbi \u00e9p\u00edt\u00e9sek is fel tudj\u00e1k venni a sz\u00fcks\u00e9ges elemeket a gyors\u00edt\u00f3t\u00e1rb\u00f3l.<\/p>\n<p><b>3. opci\u00f3.<\/b> Ennek a m\u00f3dszernek a l\u00e9nyege, hogy t\u00f6bb k\u00e9pet egyes\u00edts\u00fcnk egy projektbe, k\u00f6z\u00f6s k\u00f6nyvt\u00e1rral a kont\u00e9ner k\u00e9pek sz\u00e1m\u00e1ra.<\/p>\n<pre><code class=\"plaintext\"># mkdir \/var\/lib\/project3\n# podman run --security-opt label_level=s0:C100, C200 -v .\/build:\/build:z \n-v \/var\/lib\/project3:\/var\/lib\/containers:Z quay.io\/buildah\/stable buildah  -t image3 bud \/build\n# podman run --security-opt label_level=s0:C100, C200 \n-v \/var\/lib\/project3:\/var\/lib\/containers quay.io\/buildah\/stable buildah push image3  registry.company.com\/myuser\n<\/code><\/pre>\n<p>\nEbben a p\u00e9ld\u00e1ban nem t\u00f6r\u00f6lj\u00fck a projekt mapp\u00e1t (\/var\/lib\/project3) a futtat\u00e1sok k\u00f6z\u00f6tt, ez\u00e9rt az \u00f6sszes k\u00e9s\u0151bbi \u00e9p\u00edt\u00e9s a projekten bel\u00fcl a gyors\u00edt\u00f3t\u00e1r el\u0151nyeit \u00e9lvezi.<\/p>\n<p><i>Biztons\u00e1g.<\/i> Valami k\u00f6z\u00e9p a 1. \u00e9s a 2. lehet\u0151s\u00e9g k\u00f6z\u00f6tt. Egyr\u00e9szt a kont\u00e9nerek nem f\u00e9rnek hozz\u00e1 a gazdag\u00e9pen tal\u00e1lhat\u00f3 tartalomhoz, \u00edgy nem tudnak rosszat juttatni a Podman\/CRI-O k\u00e9pt\u00e1rol\u00f3j\u00e1ba. M\u00e1sr\u00e9szt a kont\u00e9ner a saj\u00e1t projektj\u00e9n bel\u00fcl beavatkozhat m\u00e1s kont\u00e9nerek \u00e9p\u00edt\u00e9s\u00e9be.<\/p>\n<p><i>Teljes\u00edtm\u00e9ny.<\/i> Itt ez rosszabb, mint a gazdag\u00e9p szint\u0171 k\u00f6z\u00f6s gyors\u00edt\u00f3t\u00e1r haszn\u00e1latakor, mivel nem lehet haszn\u00e1lni a Podman\/CRI-O eszk\u00f6zeivel m\u00e1r kor\u00e1bban let\u00f6lt\u00f6tt k\u00e9peket. Azonban miut\u00e1n a Buildah let\u00f6lti a k\u00e9pet, azt b\u00e1rmelyik k\u00e9s\u0151bbi \u00e9p\u00edt\u00e9sn\u00e9l fel lehet haszn\u00e1lni a projekten bel\u00fcl.<\/p>\n<h4>Tov\u00e1bbi t\u00e1rol\u00f3k<\/h4>\n<p>\nA <noindex><a rel=\"nofollow\" href=\"https:\/\/github.com\/containers\/storage\">containers\/storage<\/a><\/noindex> Van egy nagyszer\u0171 dolog, mint az additional stores, aminek k\u00f6sz\u00f6nhet\u0151en a kont\u00e9nermotorok a kont\u00e9nerek ind\u00edt\u00e1sa \u00e9s \u00f6sszeszerel\u00e9se sor\u00e1n k\u00e9pesek k\u00fcls\u0151 k\u00e9pt\u00e1rol\u00f3k haszn\u00e1lat\u00e1ra, olvas\u00e1si enged\u00e9llyel. L\u00e9nyeg\u00e9ben a storage.conf f\u00e1jlba hozz\u00e1adhatunk egy vagy t\u00f6bb \"csak olvas\u00e1sra\" sz\u00e1nt t\u00e1rol\u00f3t, \u00edgy a kont\u00e9ner elind\u00edt\u00e1sakor a kont\u00e9nermotor ezeket keresve megn\u00e9zi, hogy megtal\u00e1lja a sz\u00fcks\u00e9ges k\u00e9pet. Csak abban az esetben t\u00f6lt le k\u00e9pet a registryb\u0151l, ha nem tal\u00e1lja meg egyetlen t\u00e1rol\u00f3ban sem. A kont\u00e9nermotor csak az \u00edrhat\u00f3 t\u00e1rol\u00f3kra tud \u00edrni...<\/p>\n<p>Ha visszag\u00f6rget\u00fcnk, \u00e9s megn\u00e9zz\u00fck a Dockerfile-t, amelyet a quay.io\/buildah\/stable k\u00e9p \u00f6sszeszerel\u00e9s\u00e9hez haszn\u00e1lunk, akkor ilyen sorokat tal\u00e1lunk:<\/p>\n<pre><code class=\"plaintext\"># Adjust storage.conf to enable Fuse storage.\nRUN sed -i -e 's|^#mount_program|mount_program|g' -e '\/additionalimage.*\/a \"\/var\/lib\/shared\",' \/etc\/containers\/storage.conf\nRUN mkdir -p \/var\/lib\/shared\/overlay-images \/var\/lib\/shared\/overlay-layers; touch \/var\/lib\/shared\/overlay-images\/images.lock; touch \/var\/lib\/shared\/overlay-layers\/layers.lock\n<\/code><\/pre>\n<p>\nAz els\u0151 sorban m\u00f3dos\u00edtjuk a kont\u00e9nerk\u00e9pben l\u00e9v\u0151 \/etc\/containers\/storage.conf f\u00e1jlt, \u00e9s azt mondjuk, hogy a storage driver haszn\u00e1lja az \"additionalimagestores\"-t a \/var\/lib\/shared mapp\u00e1ban. A k\u00f6vetkez\u0151 sorban k\u00f6z\u00f6s mapp\u00e1t hozunk l\u00e9tre, \u00e9s hozz\u00e1adunk n\u00e9h\u00e1ny lock-f\u00e1jlt, hogy elker\u00fclj\u00fck a containers\/storage oldalr\u00f3l \u00e9rkez\u0151 hib\u00e1kat. L\u00e9nyeg\u00e9ben csak egy \u00fcres kont\u00e9nerk\u00e9pt\u00e1rol\u00f3t hozunk l\u00e9tre. <\/p>\n<p>Ha a containers\/storage-t egy szinttel a mappa felett csatlakoztatjuk, akkor a Buildah haszn\u00e1lhatja a k\u00e9peket.<\/p>\n<p>Most t\u00e9rj\u00fcnk vissza a fent eml\u00edtett 2. verzi\u00f3hoz, amikor a Buildah kont\u00e9ner olvashat \u00e9s \u00edrhat a containers\/store-ra a hosztokon, \u00edgy maxim\u00e1lis teljes\u00edtm\u00e9nyt ny\u00fajt az Podman\/CRI-O szint\u0171 k\u00e9pk\u00e9sz\u00edt\u00e9si gyors\u00edt\u00f3t\u00e1raz\u00e1s r\u00e9v\u00e9n, de minim\u00e1lis biztons\u00e1got, mert k\u00f6zvetlen\u00fcl \u00edrhat a t\u00e1rol\u00f3kba. Most pedig kapcsoljunk hozz\u00e1 tov\u00e1bbi t\u00e1rol\u00f3kat, \u00e9s megkapjuk a legjobb dolgokat a k\u00e9t vil\u00e1gban.<\/p>\n<pre><code class=\"plaintext\"># mkdir \/var\/lib\/containers4\n# podman run -v .\/build:\/build:z -v \/var\/lib\/containers\/storage:\/var\/lib\/shared:ro -v  \/var\/lib\/containers4:\/var\/lib\/containers:Z  quay.io\/buildah\/stable \n buildah  -t image4 bud \/build\n# podman run -v \/var\/lib\/containers\/storage:\/var\/lib\/shared:ro  \n-v &gt;\/var\/lib\/containers4:\/var\/lib\/containers:Z quay.io\/buildah\/stable buildah push image4  registry.company.com\/myuser\n# rm -rf \/var\/lib\/continers4\n<\/code><\/pre>\n<p>\nNe felejtsd el, hogy a hoszt \/var\/lib\/containers\/storage k\u00f6nyvt\u00e1r\u00e1t olvas\u00e1si enged\u00e9llyel csatlakoztatt\u00e1k a kont\u00e9ner belsej\u00e9ben l\u00e9v\u0151 \/var\/lib\/shared mapp\u00e1hoz. Ez\u00e9rt, mivel a kont\u00e9nerben dolgozik, a Buildah b\u00e1rmilyen k\u00e9pet haszn\u00e1lhat, amelyet kor\u00e1bban a Podman\/CRI-O \u00e1ltal let\u00f6lt\u00f6ttek (hell\u00f3, sebess\u00e9g), de csak a saj\u00e1t t\u00e1rol\u00f3j\u00e1ba tud \u00edrni (hell\u00f3, biztons\u00e1g). Szint\u00e9n vegy\u00e9tek \u00e9szre, hogy mindez a kont\u00e9ner SELinux elv\u00e1laszt\u00e1s\u00e1nak kikapcsol\u00e1sa n\u00e9lk\u00fcl t\u00f6rt\u00e9nik.<\/p>\n<h4>Fontos megjegyz\u00e9s<\/h4>\n<p>\nSemmik\u00e9ppen ne t\u00e1vol\u00edts el k\u00e9peket az als\u00f3 t\u00e1rol\u00f3b\u00f3l. Ellenkez\u0151 esetben a Buildah kont\u00e9ner \u00f6sszeomolhat.<\/p>\n<h4>\u00c9s ez m\u00e9g nem minden el\u0151ny<\/h4>\n<p>\nThe capabilities of additional storage are not limited to the scenario described above. For example, all container images can be placed in a shared network storage and made accessible to all Buildah containers. Suppose we have hundreds of images that our CI\/CD system regularly uses for building container images. We concentrate all these images on a single host-storage and then, using preferred network storage solutions (NFS, Gluster, Ceph, ISCSI, S3...), provide shared access to this storage for all Buildah or Kubernetes nodes.<\/p>\n<p>Most el\u00e9g, ha ezt a h\u00e1l\u00f3zati t\u00e1rol\u00f3t egy Buildah kont\u00e9nerbe csatoljuk a \/var\/lib\/shared \u00fatvonalon, \u00e9s k\u00e9sz is \u2013 a Buildah-kont\u00e9nereknek t\u00f6bb\u00e9 nem kell k\u00e9peket let\u00f6lteni\u00fck pull seg\u00edts\u00e9g\u00e9vel. \u00cdgy megsz\u00fcntetj\u00fck az el\u0151k\u00e9sz\u00edt\u00e9si f\u00e1zist (pre-population) \u00e9s azonnal k\u00e9szen \u00e1llunk a kont\u00e9nerek telep\u00edt\u00e9s\u00e9re.<\/p>\n<p>Term\u00e9szetesen ezeket a megl\u00e9v\u0151 Kubernetes rendszeren vagy kont\u00e9nerinfrastrukt\u00far\u00e1n bel\u00fcl is felhaszn\u00e1lhatjuk, hogy kont\u00e9nereket ind\u00edtsunk \u00e9s futtassunk b\u00e1rhol an\u00e9lk\u00fcl, hogy b\u00e1rmilyen k\u00e9pet le kellene t\u00f6lteni pull-lal. S\u0151t, a kont\u00e9nerregiszter, ha push k\u00e9relmet kap egy friss\u00edtett k\u00e9p felt\u00f6lt\u00e9s\u00e9re, automatikusan elk\u00fcldheti ezt a k\u00e9pet a k\u00f6z\u00f6s h\u00e1l\u00f3zati t\u00e1rol\u00f3ba, ahol az azonnal el\u00e9rhet\u0151v\u00e9 v\u00e1lik minden csom\u00f3pont sz\u00e1m\u00e1ra.<\/p>\n<p>A kont\u00e9nerk\u00e9pek m\u00e9rete n\u00e9ha t\u00f6bb gigab\u00e1jtra is r\u00faghat. A kieg\u00e9sz\u00edt\u0151 t\u00e1rol\u00f3k funkci\u00f3ja lehet\u0151v\u00e9 teszi, hogy ne kelljen kl\u00f3nozni ezeket a k\u00e9peket a csom\u00f3pontokra, \u00e9s a kont\u00e9nerek ind\u00edt\u00e1sa gyakorlatilag azonnali lesz.<\/p>\n<p>Ezen k\u00edv\u00fcl jelenleg egy \u00faj overlay volume mounts funkci\u00f3n dolgozunk, amely m\u00e9g gyorsabb\u00e1 teszi a kont\u00e9nerek \u00e9p\u00edt\u00e9s\u00e9t.<\/p>\n<h3>Z\u00e1r\u00e1s<\/h3>\n<p>\nA Buildah a Kubernetes\/CRI-O, Podman vagy ak\u00e1r Docker k\u00f6rnyezet\u00e9ben val\u00f3 v\u00e9grehajt\u00e1sa teljesen lehets\u00e9ges, r\u00e1ad\u00e1sul ez egyszer\u0171bb \u00e9s sokkal biztons\u00e1gosabb, mint a docker.socket haszn\u00e1lata. Jelent\u0151sen megn\u00f6velt\u00fck a k\u00e9pek kezel\u00e9s\u00e9nek rugalmass\u00e1g\u00e1t, \u00e9s most k\u00fcl\u00f6nf\u00e9le m\u00f3dokon ind\u00edthatja \u0151ket az optim\u00e1lis egyens\u00faly \u00e9rdek\u00e9ben a biztons\u00e1g \u00e9s a teljes\u00edtm\u00e9ny k\u00f6z\u00f6tt.<\/p>\n<p>A kieg\u00e9sz\u00edt\u0151 t\u00e1rol\u00f3k funkci\u00f3ja lehet\u0151v\u00e9 teszi, hogy felgyors\u00edtsuk vagy ak\u00e1r teljesen megsz\u00fcntess\u00fck a k\u00e9pek let\u00f6lt\u00e9s\u00e9t a csom\u00f3pontokra.<br \/>\n<br \/>Forr\u00e1s: <a content=\"nofollow\" rel=\"nofollow\" href=\"https:\/\/habr.com\/ru\/company\/redhatrussia\/blog\/470928\/\">habr.com<\/a><\/p>","protected":false,"gt_translate_keys":[{"key":"rendered","format":"html"}]},"excerpt":{"rendered":"<p>\u0412 \u0447\u0435\u043c \u043f\u0440\u0435\u043b\u0435\u0441\u0442\u044c \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0441\u0440\u0435\u0434\u044b \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u043e\u0432 \u043d\u0430 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0435 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u0441\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0449\u0438\u0435? \u0412 \u0447\u0430\u0441\u0442\u043d\u043e\u0441\u0442\u0438, \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u044d\u0442\u0438 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0447\u0430\u0442\u044c \u043a\u043e\u043c\u0431\u0438\u043d\u0438\u0440\u043e\u0432\u0430\u0442\u044c, \u0447\u0442\u043e\u0431\u044b \u043e\u043d\u0438 \u0437\u0430\u0449\u0438\u0449\u0430\u043b\u0438 \u0434\u0440\u0443\u0433 \u0434\u0440\u0443\u0433\u0430. \u041c\u043d\u043e\u0433\u0438\u0445 \u043f\u0440\u0438\u0432\u043b\u0435\u043a\u0430\u0435\u0442 \u0438\u0434\u0435\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u0441\u0431\u043e\u0440\u043a\u0443 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u043d\u044b\u0445 OCI-\u043e\u0431\u0440\u0430\u0437\u043e\u0432 \u0432 \u0440\u0430\u043c\u043a\u0430\u0445 Kubernetes \u0438\u043b\u0438 \u043f\u043e\u0434\u043e\u0431\u043d\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u044b. \u0414\u043e\u043f\u0443\u0441\u0442\u0438\u043c, \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c CI\/CD, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u043e \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u0442 \u043e\u0431\u0440\u0430\u0437\u044b, \u0442\u043e\u0433\u0434\u0430 \u0447\u0442\u043e-\u0442\u043e \u0442\u0438\u043f\u0430 Red Hat OpenShift\/Kubernetes \u0431\u044b\u043b\u043e [&hellip;]<\/p>\n","protected":false,"gt_translate_keys":[{"key":"rendered","format":"html"}]},"author":1,"featured_media":29093,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[688],"tags":[],"class_list":["post-38785","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-administrirovanie"],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 5.0.3 - aioseo.com -->\n\t<meta name=\"description\" content=\"\u0412 \u0447\u0435\u043c \u043f\u0440\u0435\u043b\u0435\u0441\u0442\u044c \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0441\u0440\u0435\u0434\u044b \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u043e\u0432 \u043d\u0430 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0435 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u0441\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0449\u0438\u0435?\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"Yuri Gagarin\"\/>\n\t<link rel=\"canonical\" href=\"https:\/\/prohoster.info\/hu\/blog\/administrirovanie\/rekomendatsii-po-zapusku-buildah-vnutri-kontejnera\" \/>\n\t\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 5.0.3\" \/>\n\t\t<meta property=\"og:locale\" content=\"hu_HU\" \/>\n\t\t<meta property=\"og:site_name\" content=\"ProHoster | \u041a\u0443\u043f\u0438\u0442\u044c \u043d\u0430\u0434\u0435\u0436\u043d\u044b\u0439 \u0445\u043e\u0441\u0442\u0438\u043d\u0433 \u0434\u043b\u044f \u0441\u0430\u0439\u0442\u043e\u0432 \u0441 \u0437\u0430\u0449\u0438\u0442\u043e\u0439 \u043e\u0442 DDoS, VPS VDS \u0441\u0435\u0440\u0432\u0435\u0440\u044b\" \/>\n\t\t<meta property=\"og:type\" content=\"article\" \/>\n\t\t<meta property=\"og:title\" content=\"\ud83e\udd47\u0420\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0430\u0446\u0438\u0438 \u043f\u043e \u0437\u0430\u043f\u0443\u0441\u043a\u0443 Buildah \u0432\u043d\u0443\u0442\u0440\u0438 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0430 | ProHoster\" \/>\n\t\t<meta property=\"og:description\" content=\"\u0412 \u0447\u0435\u043c \u043f\u0440\u0435\u043b\u0435\u0441\u0442\u044c \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0441\u0440\u0435\u0434\u044b \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u043e\u0432 \u043d\u0430 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0435 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u0441\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0449\u0438\u0435?\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/prohoster.info\/hu\/blog\/administrirovanie\/rekomendatsii-po-zapusku-buildah-vnutri-kontejnera\" \/>\n\t\t<meta property=\"og:image\" content=\"https:\/\/prohoster.info\/wp-content\/uploads\/2021\/11\/logo-350.jpg\" \/>\n\t\t<meta property=\"og:image:secure_url\" content=\"https:\/\/prohoster.info\/wp-content\/uploads\/2021\/11\/logo-350.jpg\" \/>\n\t\t<meta property=\"og:image:width\" content=\"350\" \/>\n\t\t<meta property=\"og:image:height\" content=\"350\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2019-10-31T19:25:55+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2019-10-31T19:25:55+00:00\" \/>\n\t\t<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/prohoster\" \/>\n\t\t<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/prohoster\" \/>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"\ud83e\udd47Javaslatok a Buildah kont\u00e9neren bel\u00fcli futtat\u00e1s\u00e1ra | ProHoster","description":"Mi a var\u00e1zsa a kont\u00e9nerek v\u00e9grehajt\u00e1si k\u00f6rnyezet\u00e9nek k\u00fcl\u00f6nb\u00f6z\u0151 eszk\u00f6z\u00f6kre t\u00f6rt\u00e9n\u0151 feloszt\u00e1s\u00e1nak?","canonical_url":"https:\/\/prohoster.info\/hu\/blog\/administrirovanie\/rekomendatsii-po-zapusku-buildah-vnutri-kontejnera","robots":"max-image-preview:large","keywords":"","webmasterTools":{"miscellaneous":""},"schema":null,"og:locale":"hu_HU","og:site_name":"ProHoster | \u041a\u0443\u043f\u0438\u0442\u044c \u043d\u0430\u0434\u0435\u0436\u043d\u044b\u0439 \u0445\u043e\u0441\u0442\u0438\u043d\u0433 \u0434\u043b\u044f \u0441\u0430\u0439\u0442\u043e\u0432 \u0441 \u0437\u0430\u0449\u0438\u0442\u043e\u0439 \u043e\u0442 DDoS, VPS VDS \u0441\u0435\u0440\u0432\u0435\u0440\u044b","og:type":"article","og:title":"\ud83e\udd47\u0420\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0430\u0446\u0438\u0438 \u043f\u043e \u0437\u0430\u043f\u0443\u0441\u043a\u0443 Buildah \u0432\u043d\u0443\u0442\u0440\u0438 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0430 | ProHoster","og:description":"\u0412 \u0447\u0435\u043c \u043f\u0440\u0435\u043b\u0435\u0441\u0442\u044c \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0441\u0440\u0435\u0434\u044b \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u043e\u0432 \u043d\u0430 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0435 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u0441\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0449\u0438\u0435?","og:url":"https:\/\/prohoster.info\/hu\/blog\/administrirovanie\/rekomendatsii-po-zapusku-buildah-vnutri-kontejnera","og:image":"https:\/\/prohoster.info\/wp-content\/uploads\/2021\/11\/logo-350.jpg","og:image:secure_url":"https:\/\/prohoster.info\/wp-content\/uploads\/2021\/11\/logo-350.jpg","og:image:width":350,"og:image:height":350,"article:published_time":"2019-10-31T19:25:55+00:00","article:modified_time":"2019-10-31T19:25:55+00:00","article:publisher":"https:\/\/www.facebook.com\/prohoster","article:author":"https:\/\/www.facebook.com\/prohoster"},"aioseo_meta_data":{"post_id":"38785","title":null,"description":null,"keywords":null,"keyphrases":null,"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":null,"og_custom_url":null,"og_article_section":null,"og_article_tags":null,"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"","isEnabled":true},"graphs":[]},"schema_type":null,"schema_type_options":null,"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":null,"robots_max_videopreview":null,"robots_max_imagepreview":"large","priority":null,"frequency":null,"local_seo":null,"seo_analyzer_scan_date":"2026-01-23 23:24:21","breadcrumb_settings":null,"limit_modified_date":false,"reviewed_by":null,"ai":null,"created":"2021-03-01 01:03:14","updated":"2026-01-23 23:24:21","focus_keyword":null,"additional_keywords":null,"truseo_locale":null},"gt_translate_keys":[{"key":"link","format":"url"}],"_links":{"self":[{"href":"https:\/\/prohoster.info\/hu\/wp-json\/wp\/v2\/posts\/38785","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/prohoster.info\/hu\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/prohoster.info\/hu\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/prohoster.info\/hu\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/prohoster.info\/hu\/wp-json\/wp\/v2\/comments?post=38785"}],"version-history":[{"count":0,"href":"https:\/\/prohoster.info\/hu\/wp-json\/wp\/v2\/posts\/38785\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/prohoster.info\/hu\/wp-json\/wp\/v2\/media\/29093"}],"wp:attachment":[{"href":"https:\/\/prohoster.info\/hu\/wp-json\/wp\/v2\/media?parent=38785"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/prohoster.info\/hu\/wp-json\/wp\/v2\/categories?post=38785"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/prohoster.info\/hu\/wp-json\/wp\/v2\/tags?post=38785"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}