User Tools

Site Tools


f30_buildah

Overview

Basics

buildah sits on top of:

  • OCI containers/image project (copy, push, pull, inspect images)
  • OCI containers/storage project (store FS layers, images and containers)

buildah can build images from any of:

  • existing images
  • scratch
  • Dockerfiles

Available commands:

  add                    Add content to the container
  build-using-dockerfile Build an image using instructions in a Dockerfile
  commit                 Create an image from a working container
  config                 Update image configuration settings
  containers             List working containers and their base images
  copy                   Copy content into the container
  from                   Create a working container based on an image
  help                   Help about any command
  images                 List images in local storage
  info                   Display Buildah system information
  inspect                Inspect the configuration of a container or image
  mount                  Mount a working container's root filesystem
  pull                   Pull an image from the specified location
  push                   Push an image to a specified destination
  rename                 Rename a container
  rm                     Remove one or more working containers
  rmi                    Remove one or more images from local storage
  run                    Run a command inside of the container
  tag                    Add an additional name to a local image
  umount                 Unmount the root file system of the specified working containers
  unshare                Run a command in a modified user namespace
  version                Display the Buildah version information

Build container from existing image

Delete all existing containers and check:

$ buildah rm --all
$ buildah containers
CONTAINER ID  BUILDER  IMAGE ID     IMAGE NAME                       CONTAINER NAME
$

Build from Fedora image and verify:

$ fc=$(buildah from fedora)
$ echo ${fc}
fedora-working-container
$

Run:

$ buildah run $fc bash
#

Running command in container

$ buildah run ${fc} cat /etc/os-release

Building containers from scratch

$ sc=$(buildah from scratch)
$ buildah containers
CONTAINER ID  BUILDER  IMAGE ID     IMAGE NAME                       CONTAINER NAME
6935a1961a34     *     d09302f77cfc docker.io/library/fedora:latest  fedora-working-container
4dd92fc19b8a     *                  scratch                          working-container
$
f30_buildah.txt · Last modified: 2019/04/03 08:23 by rpjday