Buildah: support for multiple FROM instructions

Created on 1 Feb 2018  路  13Comments  路  Source: containers/buildah

Description
Upstream now has multiple image builds.
For example, working with the Grafeas project their Dockerfile does a build container, and then copies the binary to a minimal image.

Steps to reproduce the issue:

  1. git clone https://github.com/grafeas/grafeas
  2. cd grafeas
  3. sudo buildah bud -t grafeas .

Describe the results you received:

error building: error determining starting point for build: multiple FROM statements are not supported

Describe the results you expected:
an image

Output of rpm -q buildah or apt list buildah:

buildah-0.11-1.git6bad262.fc26.x86_64

Output of buildah version:

Version:       0.11
Go Version:    go1.8.5
Image Spec:    1.0.0
Runtime Spec:  1.0.0
Git Commit:    6bad262
Built:         Wed Jan 17 08:49:09 2018
OS/Arch:       linux/amd64

Output of cat /etc/*release:

Fedora release 26 (Twenty Six)
NAME=Fedora
VERSION="26 (Workstation Edition)"
ID=fedora
VERSION_ID=26
PRETTY_NAME="Fedora 26 (Workstation Edition)"
ANSI_COLOR="0;34"
CPE_NAME="cpe:/o:fedoraproject:fedora:26"
HOME_URL="https://fedoraproject.org/"
BUG_REPORT_URL="https://bugzilla.redhat.com/"
REDHAT_BUGZILLA_PRODUCT="Fedora"
REDHAT_BUGZILLA_PRODUCT_VERSION=26
REDHAT_SUPPORT_PRODUCT="Fedora"
REDHAT_SUPPORT_PRODUCT_VERSION=26
PRIVACY_POLICY_URL=https://fedoraproject.org/wiki/Legal:PrivacyPolicy
VARIANT="Workstation Edition"
VARIANT_ID=workstation
Fedora release 26 (Twenty Six)
Fedora release 26 (Twenty Six)

Output of uname -a:

Linux chacha.usersys.redhat.com 4.14.14-200.fc26.x86_64 #1 SMP Fri Jan 19 13:27:06 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

Output of cat /etc/containers/storage.conf:

# storage.conf is the configuration file for all tools
# that share the containers/storage libraries
# See man 5 containers-storage.conf for more information

# The "container storage" table contains all of the server options.
[storage]

# Default Storage Driver
driver = "overlay"

# Temporary storage location
runroot = "/var/run/containers/storage"

# Primary Read/Write location of container storage
graphroot = "/var/lib/containers/storage"

[storage.options]
# AdditionalImageStores is used to pass paths to additional Read/Only image stores
# Must be comma separated list.
additionalimagestores = [
]

# Size is used to set a maximum size of the container image.  Only supported by
# certain container storage drivers.
size = ""

# OverrideKernelCheck tells the driver to ignore kernel checks based on kernel version
override_kernel_check = "true"
kinfeature

All 13 comments

This is on our todo list, but first step it to get this support into imagebuilder.

+1. By the way, seems to be related to #242.

Yes they are the same. Just need to get someone to work on it. Move it up the priority list.

@rhatdan should we add priority tags to issues as this?

Sure, atlhough I am not sure how that helps a lot. My number one priority is to start working on User Namespace support in buildah and adding a hole bunch of missing hoptions to buildah bud and buildah run. I guess this feature is less important then UserNS but more important then these missing flags.

I see. It won't do much then.

Looking through imagebuilder's code it seems that it might not be too hard to implement this one.

I noticed there's a card for this feature here [1]. If it's not a problem, I'd like to take this one and see how far I can get.

[1] https://trello.com/c/wFliOqYo/788-buildah-spike-support-multi-stage-builds-for-feature-parity-with-docker-build

Feel free to grab it Bertinatto and TYVM!

I managed to build an imagebuilder PoC to work with multi-stage builds. Here's a docker run of the final container generated using the multi-stage Grafeas Dockerfile:

$ docker run --rm -it -p 8080:8080 5dd
2018/02/18 20:39:33 starting grpc server on localhost:8080
2018/02/18 20:39:33 grpc server is configured without client certificate authentication

This is the first step, but there's still work to do. I'll keep this Issue updated.

PS: It looks like I don't have permissions to take the (Trello) card.

@bertinatto I'll see what we can do with the Trello card. thanks for working on this!

A PR that adds multi-stage support to imagebuilder has just been submitted by @smarterclayton:

https://github.com/openshift/imagebuilder/pull/59

Excellent.

@rhatdan, I think this one can be closed since #495 was merged.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

caruccio picture caruccio  路  4Comments

jawnsy picture jawnsy  路  6Comments

stiller-leser picture stiller-leser  路  10Comments

bparees picture bparees  路  12Comments

zhouhao3 picture zhouhao3  路  9Comments