Bug 1416456

Summary: BuildConfig with Docker strategy using Dockerfile with 'FROM scratch' results in a failed build
Product: OpenShift Container Platform Reporter: Bill DeCoste <wdecoste>
Component: BuildAssignee: Ben Parees <bparees>
Status: CLOSED ERRATA QA Contact: Wang Haoran <haowang>
Severity: high Docs Contact:
Priority: unspecified    
Version: 3.4.0CC: aos-bugs, bparees, dyan, tdawson, xtian
Target Milestone: ---   
Target Release: 3.4.z   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
If this bug requires documentation, please select an appropriate Doc Type value.
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-02-22 18:11:23 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Bill DeCoste 2017-01-25 14:42:54 UTC
Description of problem:

BuildConfigs using Docker/Dockerfile strategy with FROM scratch causes a build failure: 'scratch' is a reserved name

Version-Release number of selected component (if applicable):


How reproducible:
100%


Steps to Reproduce:
1. Use BuildConfig similar to https://github.com/bdecoste/jdv-jdg-sample/blob/master/datavirt63-jdg-s2i.json#L493
2. BuildConfig points to Dockerfile with 'FROM scratch'
3.

Actual results:
Failed build: 'scratch' is a reserved name

Expected results:
Successful build


Additional info:
Was looking at the OCP3.4 branch and it looks like the code you referenced that checks for the scratch image pre-pull is missing in OCP:

https://github.com/openshift/ose/blob/enterprise-3.4/pkg/build/builder/docker.go#L97

https://github.com/openshift/origin/blob/master/pkg/build/builder/docker.go#L102-L120

Also looks like that code has changed significantly since 3.3

Comment 1 Ben Parees 2017-01-25 14:46:19 UTC
https://github.com/openshift/ose/pull/579

Comment 4 Troy Dawson 2017-02-10 23:01:00 UTC
This has been merged into ocp and is in OCP v3.4.1.7 or newer.

Comment 6 Dongbo Yan 2017-02-13 04:46:15 UTC
Verified
openshift v3.4.1.7
kubernetes v1.4.0+776c994
etcd 3.1.0-rc.0

# oc new-build -D $'FROM scratch\nENV NUM 1' --to=test

# oc logs -f bc/test
Step 1 : FROM scratch
 ---> 
Step 2 : ENV NUM 1
 ---> Running in c67ed76f2559
 ---> 328f24a22408
Removing intermediate container c67ed76f2559
Step 3 : ENV "OPENSHIFT_BUILD_NAME" "test-1" "OPENSHIFT_BUILD_NAMESPACE" "dyan1"
 ---> Running in ba4d1bf25a7a
 ---> 8bb37118587c
Removing intermediate container ba4d1bf25a7a
Successfully built 8bb37118587c

Comment 8 errata-xmlrpc 2017-02-22 18:11:23 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2017:0289