सर्वर दुनिया | गोपनीयता नीति | सहायता / संपर्क करें |
5789 / 118084319
|
Buildah : स्क्रैच से चित्र बनाएं2024/05/13 |
एक खाली कंटेनर छवि से कंटेनर छवियां बनाएं।
|
|
[1] | [scratch] छवि से बनाना प्रारंभ करें। |
# [scratch] के साथ एक खाली कंटेनर बनाएं root@dlp:~# newcontainer=$(buildah from scratch) root@dlp:~# buildah containers CONTAINER ID BUILDER IMAGE ID IMAGE NAME CONTAINER NAME cc1b24f376c9 * bf3dc08bfed0 docker.io/library/ubuntu:latest ubuntu-working-container 6d38de367b81 * bf3dc08bfed0 docker.io/library/ubuntu:latest ubuntu-working-container-1 7f0b7b799991 * scratch working-container # माउंट [scratch] कंटेनर root@dlp:~# scratchmnt=$(buildah mount $newcontainer) root@dlp:~# echo $scratchmnt /var/lib/containers/storage/overlay/5f7c39ce2cc455414777cbcda49be2a20af4e3439b1031551a79bb16f6b5fe19/merged # [scratch] कंटेनर में पैकेज स्थापित करें root@dlp:~# apt -y install debootstrap root@dlp:~# debootstrap noble $scratchmnt # अनमाउंट root@dlp:~# buildah umount $newcontainer 7f0b7b799991139a12fe6fb5a8d2cc9d768b124f5d1a62b21ba7d8114c89b455 # कंटेनर चलाएँ root@dlp:~# buildah run $newcontainer cat /etc/os-release PRETTY_NAME="Ubuntu 24.04 LTS" NAME="Ubuntu" VERSION_ID="24.04" VERSION="24.04 LTS (Noble Numbat)" VERSION_CODENAME=noble ID=ubuntu ID_LIKE=debian HOME_URL="https://www.ubuntu.com/" SUPPORT_URL="https://help.ubuntu.com/" BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/" PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy" UBUNTU_CODENAME=noble LOGO=ubuntu-logo # छवि जोड़ें root@dlp:~# buildah commit $newcontainer ubuntu-basic:latest Getting image source signatures Copying blob 8bb68f0e0f1f done | Copying config 58dcc2b741 done | Writing manifest to image destination 58dcc2b74169547109cac460bdd36b783fd4f6bf6839e478746d74b8e61e8af7root@dlp:~# buildah images REPOSITORY TAG IMAGE ID CREATED SIZE localhost/ubuntu-basic latest 58dcc2b74169 26 seconds ago 410 MB localhost/my-ubuntu latest 8f4619e42cf0 11 minutes ago 158 MB docker.io/library/ubuntu latest bf3dc08bfed0 13 days ago 78.7 MB # एक कंटेनर चलाने के लिए परीक्षण करें root@dlp:~# podman run localhost/ubuntu-basic /bin/echo "Hello my ubuntu" Hello my debian |