Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to use same argument in different scopes #1806

Open
MertCingoz opened this issue Jul 24, 2024 · 0 comments
Open

Unable to use same argument in different scopes #1806

MertCingoz opened this issue Jul 24, 2024 · 0 comments

Comments

@MertCingoz
Copy link

Description

Dockerfile

ARG JDK_SOURCE=azul/zulu-openjdk
ARG JDK_VERSION=17
FROM ${JDK_SOURCE}:${JDK_VERSION} AS build

ARG JDK_VERSION
RUN echo ${JDK_VERSION}

Dockerfile works fine when building with docker cli, but docker-maven-plugin seems to be removing outer scope.

Given Docker name 'azul/zulu-openjdk::latest' is invalid:
   * image part 'zulu-openjdk:' doesn't match allowed pattern '[a-z0-9]+(?:(?:(?:[._]|__|[-]*)[a-z0-9]+)+)?(?:(?:/[a-z0-9]+(?:(?:(?:[._]|__|[-]*)[a-z0-9]+)+)?)+)?'

My current workaround is creating dummy copy of same argument and using copy argument in inner scope.

ARG JDK_SOURCE=azul/zulu-openjdk
ARG JDK_VERSION=17
# Workaround for docker-maven-plugin to re-use arguments
ARG JDK_VERSION_COPY=${JDK_VERSION}
FROM ${JDK_SOURCE}:${JDK_VERSION} AS build

ARG JDK_VERSION_COPY
RUN echo ${JDK_VERSION_COPY}

Info

  • docker-maven-plugin version : 0.44.0
  • Maven version (mvn -v) : 3.9.8
  • Docker version :
Client:
 Version:           26.1.4
 API version:       1.45
 Go version:        go1.21.11
 Git commit:        5650f9b
 Built:             Wed Jun  5 11:26:02 2024
 OS/Arch:           darwin/arm64
 Context:           desktop-linux

Server: Docker Desktop 4.31.0 (153195)
 Engine:
  Version:          26.1.4
  API version:      1.45 (minimum version 1.24)
  Go version:       go1.21.11
  Git commit:       de5c9cf
  Built:            Wed Jun  5 11:29:12 2024
  OS/Arch:          linux/arm64
  Experimental:     false
 containerd:
  Version:          1.6.33
  GitCommit:        d2d58213f83a351ca8f528a95fbd145f5654e957
 runc:
  Version:          1.1.12
  GitCommit:        v1.1.12-0-g51d5e94
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant