Skip to content

Unable to pre-fetch an image when using build-args in FROM #3238

Closed
@AB-xdev

Description

@AB-xdev

We are using the following:

new ImageFromDockerfile()
	.withDockerfile(Paths.get("Dockerfile"))
...

Dockerfile

ARG tag=latest
FROM maven:3-openjdk-11 AS build-env
# Build
FROM domain.com/package/image:${tag}
# Copy builded stuff into container

This throws an exception, as it trys to pre-fetch an image:

11:25:48 INFO  [ducttape-0] [ilder.ImageFromDockerfile] Pre-emptively checking local images for 'domain.com/package/image:${tag}', referenced via a Dockerfile. If not available, it will be pulled.  
11:25:48 ERROR [tc-okhttp-stream-1066222696] [nc.ResultCallbackTemplate] Error during callback  
com.github.dockerjava.api.exception.BadRequestException: {"message":"invalid reference format"}

	at com.github.dockerjava.okhttp.OkHttpInvocationBuilder.execute(OkHttpInvocationBuilder.java:283)
	at com.github.dockerjava.okhttp.OkHttpInvocationBuilder.lambda$executeAndStream$4(OkHttpInvocationBuilder.java:317)
	at java.base/java.lang.Thread.run(Thread.java:834)
11:25:48 WARN  [ducttape-0] [ilder.ImageFromDockerfile] Unable to pre-fetch an image (domain.com/package/image:${tag}) depended upon by Dockerfile - image build will continue but may fail. Exception message was: {"message":"invalid reference format"}

It would be nice

  • if the code which pre-fetches/pulls the dependencies would automatically consider the use of args and either uses them to download the image or simply ignores it
  • OR if there is an option to disable the pre-fetching/pulling

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions