Buildah : Create an Image from Scratch2020/11/06 |
Create a container image from empty Container Image.
|
|
[1] | Start to create with [scratch] image. |
# create an empty container with [scratch] [root@dlp ~]# newcontainer=$(buildah from scratch) [root@dlp ~]# buildah containers CONTAINER ID BUILDER IMAGE ID IMAGE NAME CONTAINER NAME 2e0a2411f821 * 79fd58dc7611 registry.fedoraproject.org/fe... fedora-working-container 33b1b5586a2a * scratch working-container # mount [scratch] container [root@dlp ~]# scratchmnt=$(buildah mount $newcontainer) [root@dlp ~]# echo $scratchmnt /var/lib/containers/storage/overlay/4d89007738fa324bc8ac048ca81b7c22e5de055b820f442e053fefff0f0c0548/merged # install packages to [scratch] container [root@dlp ~]# dnf -y group install "Minimal Install" --releasever=33 --installroot=$scratchmnt --setopt=tsflags=nocontexts
# unmount [root@dlp ~]# buildah umount $newcontainer 33b1b5586a2aff7a6759fd7af79549f2dba3caba7e17fdc52127561288c469b3 # run container [root@dlp ~]# buildah run $newcontainer bash [root@33b1b5586a2a /]# [root@33b1b5586a2a /]# bin dev home lib64 mnt proc run srv tmp var boot etc lib media opt root sbin sys usr
[root@33b1b5586a2a /]#
# add image [root@dlp ~]# buildah commit $newcontainer fedora-minimum:latest Getting image source signatures ... ... Writing manifest to image destination Storing signatures a24d9353c2e61bd96a925558b98b439cecd2f2ae39ed15da9535d4b09c777461[root@dlp ~]# buildah images REPOSITORY TAG IMAGE ID CREATED SIZE localhost/fedora-minimum latest a24d9353c2e6 52 seconds ago 952 MB registry.fedoraproject.org/fedora latest 79fd58dc7611 9 days ago 181 MB |
Sponsored Link |
|