Bug 1572019

Summary: [RFE] ARG is not allowed to put before FROM in Dockerfile
Product: Red Hat Enterprise Linux 7 Reporter: Kenjiro Nakayama <knakayam>
Component: podmanAssignee: Brent Baude <bbaude>
Status: CLOSED ERRATA QA Contact: Martin Jenner <mjenner>
Severity: high Docs Contact:
Priority: unspecified    
Version: 7.5CC: amurdaca, dornelas, dwalsh, fkluknav, hasuzuki, jligon, lsm5, mheon, umohnani, ypu
Target Milestone: rcKeywords: Extras, FutureFeature
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-01-31 19:21:18 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:
Bug Depends On:    
Bug Blocks: 1186913, 1636853    

Description Kenjiro Nakayama 2018-04-26 01:10:10 UTC
Description of problem:

- Currently ARG is not allowed to put before FROM in Dockerfile. Please see below reproduce steps and error message.

- moby has same reports and looks like fixed it.

  https://github.com/moby/moby/issues/32457
  https://github.com/moby/moby/pull/31352

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

- docker-1.13.1-58.git87f2fab.el7.x86_64

How reproducible: 100%


Steps to Reproduce:
1. Create Dockerfile

  # cat Dockerfile 
  ARG foo="test"
  FROM busybox
  RUN echo $foo

2. Build it


  # docker build .

Actual results:

- Getting following error

  # docker build .
  Sending build context to Docker daemon 2.048 kB
  Step 1/3 : ARG foo="test"
  Please provide a source image with `from` prior to commit

Expected results:

- Build without error.

Additional info:

- OpenShift supports specific docker version. OCP 3.9 supports docker 1.13, so we would like you to backport it into docker-1.13.

Comment 3 Daniel Walsh 2019-01-02 21:44:03 UTC
Podman build now has support for this.  Should be in podman 0.12.1

Comment 5 Joy Pu 2019-01-17 10:15:49 UTC
Test with the steps in comment 1 with podman-0.12.1.2-2.git9551f6b.el7.x86_64:

# podman build -t test .
STEP 1: FROM busybox
STEP 2: RUN echo $foo
test
--> e6736a73421a23d68d7100ea2c42a54ce42e55e32781cc9b8a5e0bb65ed640d0
STEP 3: COMMIT test
[Warning] One or more build-args [foo] were not consumed

So set this to verified.

Comment 7 errata-xmlrpc 2019-01-31 19:21:18 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-2019:0241