Buildah軟件包提供了一個可用於的命令行工具
創建一個工作容器,從頭開始或使用 image作為起點
從工作容器或Dockerfile中的指令創建 image
image可以采用OCI image格式或傳統的上upstream image格式構建
掛載工作容器的根文件系統以進行操作
卸載工作容器的根文件系統
使用容器的根文件系統的更新內容作為文件系統層來創建新image
刪除工作容器或image
重命名本地容器
適用於開發人員的Buildah信息
有關博客,發布公告等信息,請訪問buildah.io網站!
Buildah和Podman的關系
Buildah和Podman是兩個互補的開源項目,可在大多數Linux平台上使用,這兩個項目都駐留在GitHub.com,Buildah在這里,Podman在這里。 Buildah和Podman都是用於Open Container Initiative(OCI)圖像和容器的命令行工具。這兩個項目的專業化差異很大。
Buildah專注於構建OCI圖像。 Buildah的命令復制Dockerfile中的所有命令。這允許使用和不使用Dockerfiles構建圖像,同時不需要任何root權限。 Buildah的最終目標是提供更低級別的coreutils界面來構建圖像。在沒有Dockerfiles的情況下構建映像的靈活性允許將其他腳本語言集成到構建過程中。 Buildah遵循一個簡單的fork-exec模型,並不作為守護進程運行,但它基於golang中的綜合API,可以存儲到其他工具中。
Podman專注於幫助您維護和修改OCI圖像的所有命令和功能,例如拉動和標記。它還允許您創建,運行和維護從這些圖像創建的容器。
Podman和Buildah之間的一個主要區別是他們的容器概念。 Podman允許用戶創建“傳統容器”,其中這些容器的意圖是長壽的。雖然Buildah容器實際上只是為了允許將內容添加回容器圖像而創建的。想到它的一種簡單方法是buildah run命令模擬Dockerfile中的RUN命令,而podman run命令模擬功能中的docker run命令。由於這一點及其底層存儲差異,您無法在Buildah中看到Podman容器,反之亦然。
Example
From ./examples/lighttpd.sh:
$
cat > lighttpd.sh <<"EOF"
#!/bin/bash -x
ctr1=$(buildah from "${1:-fedora}")
## Get all updates and install our minimal httpd server
buildah run "$ctr1" -- dnf update -y
buildah run "$ctr1" -- dnf install -y lighttpd
## Include some buildtime annotations
buildah config --annotation "com.example.build.host=$(uname -n)" "$ctr1"
## Run our server and expose the port
buildah config --cmd "/usr/sbin/lighttpd -D -f /etc/lighttpd/lighttpd.conf" "$ctr1"
buildah config --port 80 "$ctr1"
## Commit this container to an image name
buildah commit "$ctr1" "${2:-$USER/lighttpd}"
EOF
$ chmod +x lighttpd.sh
$ sudo ./lighttpd.sh
簡而言之,Buildah是創建OCI圖像的有效方式,而Podman允許您使用熟悉的容器cli命令在生產環境中管理和維護這些圖像和容器。有關詳細信息,請參閱“容器工具指南”。
命令:
Command | Description |
---|---|
buildah-add(1) | Add the contents of a file, URL, or a directory to the container. |
buildah-bud(1) | Build an image using instructions from Dockerfiles. |
buildah-commit(1) | Create an image from a working container. |
buildah-config(1) | Update image configuration settings. |
buildah-containers(1) | List the working containers and their base images. |
buildah-copy(1) | Copies the contents of a file, URL, or directory into a container's working directory. |
buildah-from(1) | Creates a new working container, either from scratch or using a specified image as a starting point. |
buildah-images(1) | List images in local storage. |
buildah-info(1) | Display Buildah system information. |
buildah-inspect(1) | Inspects the configuration of a container or image. |
buildah-mount(1) | Mount the working container's root filesystem. |
buildah-pull(1) | Pull an image from the specified location. |
buildah-push(1) | Push an image from local storage to elsewhere. |
buildah-rename(1) | Rename a local container. |
buildah-rm(1) | Removes one or more working containers. |
buildah-rmi(1) | Removes one or more images. |
buildah-run(1) | Run a command inside of the container. |
buildah-tag(1) | Add an additional name to a local image. |
buildah-umount(1) | Unmount a working container's root file system. |
buildah-unshare(1) | Launch a command in a user namespace with modified ID mappings. |
buildah-version(1) | Display the Buildah Version Information |