ARG not support in FROM
See original GitHub issueDescription
Trying to build a Dockerfile
like the following fails when using the maven plugin, but is supported and succeeds when building from the command line.
https://docs.docker.com/engine/reference/builder/#from
ARG VERSION:latest
FROM something:$VERSION
[ERROR] Failed to execute goal io.fabric8:docker-maven-plugin:0.22.1:build (build-docker-image) on project docker: Execution build-docker-image of goal io.fabric8:docker-maven-plugin:0.22.1:build failed: Given Docker name 'something:$VERSION' is invalid:
[ERROR] * tag part '$VERSION' doesn't match allowed pattern '^[\w][\w.-]{0,127}$'
[ERROR] See http://bit.ly/docker_image_fmt for more details
[ERROR] -> [Help 1]
VS when run from the command line
Sending build context to Docker daemon 482.7MB
Step 1/14 : ARG VERSION=latest
--->
Step 2/14 : FROM something:$VERSION
---> bd7be3f0d8c6
...........
...........
Info
- Maven version (
mvn -v
) :
Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5; 2015-11-10T08:41:47-08:00)
Maven home: /opt/apache-maven-3.3.9
Java version: 1.8.0_112, vendor: Oracle Corporation
Java home: /Library/Java/JavaVirtualMachines/jdk1.8.0_112.jdk/Contents/Home/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "mac os x", version: "10.12.6", arch: "x86_64", family: "mac"
- Docker version (
docker version
):
Client:
Version: 17.06.2-ce
API version: 1.30
Go version: go1.8.3
Git commit: cec0b72
Built: Tue Sep 5 20:12:06 2017
OS/Arch: darwin/amd64
Server:
Version: 17.06.2-ce
API version: 1.30 (minimum version 1.12)
Go version: go1.8.3
Git commit: cec0b72
Built: Tue Sep 5 19:59:19 2017
OS/Arch: linux/amd64
Experimental: true
Issue Analytics
- State:
- Created 6 years ago
- Reactions:2
- Comments:19 (1 by maintainers)
Top Results From Across the Web
ARG not available in following FROM · Issue #40830 - GitHub
Description When using ARG to specify an image or tag in a multi-stage Dockerfile, the ARG is not being applied correctly.
Read more >ARG substitution in RUN command not working for Dockerfile
Another thing to be careful about is that after every FROM statements all the ARG s get collected and are no longer available....
Read more >Storage arrays with nested mappings do not support .push ...
I have a struct with a nested mapping which I am instantiating and trying to push to an array, but I'm receiving the...
Read more >argparse — Parser for command-line options, arguments and ...
The argparse module's support for command-line interfaces is built around an instance of argparse. ... Default value used when an argument is not...
Read more >Understanding Docker Build Args, Environment Variables and ...
An overview of ways to set and use variables when building images, starting containers and using docker-compose.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Tested with latest 0.31.0 release and had same issue. Tried with @frawa suggestion but I had same result. The only workaroud that worked was putting args as canonical maven properties as stated by @rhuss Until this unexpected bug gets resolved, I would suggest to update documentation (which is well written in general) with an alert linking this issue.
@KowKiller sorry, there is probably no good easy solution. You could go to use multi-modules (which then has different property names) or use profiles and two runs, but that’s tedious.
Maybe we should fix this issue ? Unfortunately, I don’t have time to code on it, but maybe someone could pick up the ideas laid out in this issue ?