Skip to content
This repository has been archived by the owner on Mar 31, 2022. It is now read-only.

Could not acquire image ID or digest following build #282

Closed
dlanorf opened this issue Mar 28, 2019 · 32 comments
Closed

Could not acquire image ID or digest following build #282

dlanorf opened this issue Mar 28, 2019 · 32 comments
Labels

Comments

@dlanorf
Copy link

dlanorf commented Mar 28, 2019

Is this a BUG REPORT or FEATURE REQUEST?:

Description

[Add feature/bug description here]

How to reproduce

[Add steps on how to reproduce this issue]

What do you expect

[Describe what do you expect to happen]

What happened instead

[Describe the actual results]

Software:

  • docker version: [Add the output of docker version here, both client and server]
  • Spotify's dockerfile-maven version: [Add dockerfile-maven version here]

Full backtrace

[Paste full backtrace here]
@jeanemvista
Copy link

I have the same message on Windows 10 :

org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.spotify:dockerfile-maven-plugin:1.4.10:build (default) on project POA-Server: Execution default of goal com.spotify:dockerfile-maven-plugin:1.4.10:build failed: Could not acquire image ID or digest following build

Maven version
Apache Maven 3.5.3 (3383c37e1f9e9b3bc3df5050c29c8aff9f295297; 2018-02-24T20:49:05+01:00) Maven home: C:\Program Files (x86)\Apache\maven\bin\.. Java version: 10.0.1, vendor: Oracle Corporation Java home: C:\Program Files\Java\jdk-10.0.1 Default locale: fr_FR, platform encoding: Cp1252 OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"

Docker version
18.06

@jeanemvista
Copy link

I test with 1.4.9 version, it's works fine.

@loicsalou
Copy link

I'm facing the same issue on my Win10 workstation whereas it works perfectly on my personal Macbook.
I tried downgrading the dockerfile plugin back to 1.4.6 - 1.4.9 but 1.4.10 is required to be able to use a docker file from a specific path, eg "target/docker/base/dockerfile_base" (which meets my need).

any idea ?

@jeanemvista
Copy link

I confirmed, it's works fin on Mac OS with 1.4.10.

@svenhaag
Copy link

Same as?: #25

@jhitt25
Copy link

jhitt25 commented Jul 10, 2019

I am having this problem as well. I am running 1.4.10 on Win10. If i leave my Dockerfile in the project root it works fine. If i relocate it to a subdirectory and specify <dockerfile> in my pom.xml, i get this error.

rudolfgrauberger added a commit to Archi-Lab/prox-api-gateway that referenced this issue Jul 29, 2019
The the docker files are not moved in this step to the new folder structure because there is a bug with the dockerfile-maven plugin on windows (see spotify/dockerfile-maven#282)
rudolfgrauberger added a commit to Archi-Lab/prox-service-discovery that referenced this issue Jul 31, 2019
…r Windows.

There is a bug with the dockerfile-maven plugin on windows. For more information see spotify/dockerfile-maven#282
@iails01
Copy link

iails01 commented Aug 16, 2019

Maybe your Dockerfile was ignored. Add !Dockerfile in your .dockerignore will work fine.

@jl2035
Copy link

jl2035 commented Aug 26, 2019

I am having this problem as well. I am running 1.4.10 on Win10. If i leave my Dockerfile in the project root it works fine. If i relocate it to a subdirectory and specify <dockerfile> in my pom.xml, i get this error.

Are there any plans to fix this problem? Is there a workaround?

@Tool1990
Copy link

Same problem for Windows, Mac works perfectly fine. Any fix coming?

@jl2035
Copy link

jl2035 commented Aug 27, 2019

From the readme file:

At this point, we're not developing or accepting new features or even fixing non-critical bugs.

I don't believe this is going to be fixed.

@Tool1990
Copy link

I moved the Dockerfile to the same directory with pom.xml and it works

@jl2035
Copy link

jl2035 commented Aug 27, 2019

Sure. But that's not what I want. I want to use the same context directory, but with different Dockerfiles for each build profile.

@kallaouat-gresham
Copy link

We have recently had this issue and it was due to our repository tag containing capital letters. When removing them, the build succeeds.

@jmslick
Copy link

jmslick commented Nov 1, 2019

I moved Dockerfile to project root directory, and then the Docker build worked.

For a further test, I then upper cased the repository tag, which resulted in a different error stating that lower case is required:

Repo name "DOCKER.PREFIX/configurationserver" must contain only lowercase, numbers, '-', '_' or '.'. -

The point is that an upper case repository tag did not drive the bug about "Could not acquire image ID or digest following build".

I guess we're stuck with placing Dockerfile in the project root directory.

@demobin8
Copy link

demobin8 commented Nov 7, 2019

dockerfile feature work fine, do it like this:
directory like this (generate by tree -L 2):

.
├── docker
│   └── Dockerfile
├── kubernetes
│   ├── development.yaml
│   └── service.yaml
├── mvnw
├── mvnw.cmd
├── pom.xml
├── README.md
└── src
    ├── main
    └── test

pom.xml like this:

	<plugin>
				<groupId>com.spotify</groupId>
				<artifactId>dockerfile-maven-plugin</artifactId>
				<version>1.4.10</version>
				<executions>
					<execution>
						<goals>
							<goal>build</goal>
						</goals>
					</execution>
				</executions>
				<configuration>
					<dockerfile>docker/Dockerfile</dockerfile>
					<repository>${docker.repository}/${project.artifactId}</repository>
					<buildArgs>
						<JAR_FILE>target/${project.build.finalName}</JAR_FILE>
					</buildArgs>
				</configuration>
			</plugin>

@demobin8
Copy link

demobin8 commented Nov 7, 2019

Sure. But that's not what I want. I want to use the same context directory, but with different Dockerfiles for each build profile.

see my previous reply

@guanJack
Copy link

i am facing the same issue.I have my "DockerFile" in my project root directory,and the message like this.Then i refactor the "DockerFile" to "Dockerfile",and it build succeeds.

@ab316
Copy link

ab316 commented Dec 19, 2019

For me, it turned out to be a syntax error in my Dockerfile.

@sbahloul
Copy link

sbahloul commented Feb 24, 2020

I have got the same issue with my build failing on Windows. I figured out that it was failing due to the push goal whereas the build goal alone was successful
After investigating (mvn -X), this seems to be the docker-credential-desktop command that is blocking when run by mvn. If I run it manually (echo mydockerrepository.com | docker-credential-desktop get) it is successful. So I bet that the problem may be in the way the credentials are retrieved by the plugin (or by the underlying library).

@Emmerson-Miranda
Copy link

Emmerson-Miranda commented Mar 12, 2020

I got the same problem when I got two dashes in the artifactId, for instance "cdi-bundle-a", when I change the artifactId to "cdi-bundlea" it works fine.

BTW I was assigned the artifactId to the image name:

<imageName>${project.artifactId}</imageName>

Hope this helps!

@Emmerson-Miranda
Copy link

I saw the same error when <entryPoint> element is splitted by more than one line.

@esteiner
Copy link

esteiner commented Apr 3, 2020

Probably you have specified a name for your image to be build with a uppercase letter in it.

@baiyunpeng-coder
Copy link

Try to specify that < contextdirectory > is the directory where the dockerfile is located

@stale
Copy link

stale bot commented Jul 11, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Jul 11, 2020
@stale stale bot closed this as completed Jul 18, 2020
@zhaowawj
Copy link

finally locate the problem. My configuration:

  1. specify dockerfile location: src/main/docker/Dockerfile
  2. Win10 docker, docker run as Linux mode.
    the above configuration will definitely result in the error: Could not acquire image ID or digest following build.
    Reason:
    the plugin will transform dockerfile location to windows style, and send to docker daemon to build image, but docker run in linux mode and it cannot resolve.

I've verifed this by debug run mvn build and modify the related logic, and it can successfully build.
----modify dockerfile buldParameter from 'src\main\docker\Dockerfile' to 'src/main/docker/Dockerfile'

buildParameters.add(DockerClient.BuildParam.dockerfile(

so maybe I can conclude that dockerfile config cannot be used in such situation. and we have to use maven-resources-plugin to copy all file to some place to get rid of this config.

@zhaowawj
Copy link

unless somebody delete the dockerfile config tranformation logic, and use it as it is.

@panxyush
Copy link

panxyush commented Mar 2, 2021

I encountered this problem on my Mac with docker desktop. There is a disk image size under preferences->resources->advanced. The capacity of all my local images is already larger than this setting. So, when I clean up all local images, the build succeeds.

bguerin pushed a commit to netceler/dockerfile-maven that referenced this issue Mar 20, 2021
When Dockerfile is not on the root directory of the project, under Windows its relative path is resolved with backward slashes.
But Docker-desktop run through WSL (Windows Subsystem Linux) so it does not understand backward slashes.

Fix spotify#282
@ulvestad
Copy link

I encountered this problem on my Mac with docker desktop. There is a disk image size under preferences->resources->advanced. The capacity of all my local images is already larger than this setting. So, when I clean up all local images, the build succeeds.

this fixed it for me

@windows10hater
Copy link

windows10hater commented Jul 22, 2021 via email

@dotjdk
Copy link

dotjdk commented Nov 7, 2021

I encountered this problem on my Mac with docker desktop. There is a disk image size under preferences->resources->advanced. The capacity of all my local images is already larger than this setting. So, when I clean up all local images, the build succeeds.

Did a docker system prune --all after reading this. Fixed the issue for me on Mac as well. Thanks

@ShrenikQuest
Copy link

ShrenikQuest commented Jan 7, 2022

Hello all,
we had same problem , we just had to rename from DockerFile to Dockerfile. It seems docker demon expect the filename to be case sensitive.

@chandra-ck
Copy link

Thanks @ShrenikQuest file rename worked like a charm!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests