Buildah - 一个有助于构建Open Container Initiative(OCI)容器映像的工具

Buildah软件包提供了一个可用于的命令行工具
创建一个工作容器,从头开始或使用 image作为起点
从工作容器或Dockerfile中的指令创建 image
image可以采用OCI image格式或传统的上upstream image格式构建
挂载工作容器的根文件系统以进行操作
卸载工作容器的根文件系统
使用容器的根文件系统的更新内容作为文件系统层来创建新image
删除工作容器或image
重命名本地容器

适用于开发人员的Buildah信息

有关博客,发布公告等信息,请访问buildah.io网站!

Buildah Demos

Changelog

Contributing

Development Plan

Installation notes

Troubleshooting Guide

Tutorials

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命令在生产环境中管理和维护这些图像和容器。有关详细信息,请参阅“容器工具指南”。

 命令:

CommandDescription
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
posted @ 2019-05-22 20:53  mashaoli  阅读(1637)  评论(0编辑  收藏  举报