question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ARG not support in FROM

See original GitHub issue

Description

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:closed
  • Created 6 years ago
  • Reactions:2
  • Comments:19 (1 by maintainers)

github_iconTop GitHub Comments

3reactions
vinsgithubcommented, Sep 10, 2019

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.

1reaction
rhusscommented, Nov 21, 2019

@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 ?

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found