Hello I'm trying to build a Docker image from a Docker file and get the following error:
java.lang.IllegalStateException: Could not acquire image ID or digest following build at com.google.common.base.Preconditions.checkState(Preconditions.java:444) ~[guava-21.0.jar:na] at com.spotify.docker.client.DefaultDockerClient$BuildProgressHandler.getImageId(DefaultDockerClient.java:298) ~[docker-client-8.11.7.jar:8.11.7] at com.spotify.docker.client.DefaultDockerClient$BuildProgressHandler.access$1200(DefaultDockerClient.java:287) ~[docker-client-8.11.7.jar:8.11.7] at com.spotify.docker.client.DefaultDockerClient.build(DefaultDockerClient.java:1481) ~[docker-client-8.11.7.jar:8.11.7]
I can build the same exact Dockerfile from the command line, but I can't debug this as the stack trace isn't very informative. Below I leave some information that may be relevant:
Docker version:
Client: Version: 17.03.2-ce API version: 1.27 Server: Version: 17.03.2-ce API version: 1.27 (minimum version 1.12)
spotify/docker-client version: 8.11.7
How I call the docker build function:
final AtomicReference<String> imageIdFromMessage = new AtomicReference<>();
final String returnedImageId = dockerClient.build(
Paths.get("/absolute/path/to/folder"), image.getImageName(), dockerfilefilename,new ProgressHandler() {
@Override
public void progress(ProgressMessage message) throws DockerException {
final String imageId = message.buildImageId();
if (imageId != null) {
imageIdFromMessage.set(imageId);
}
}
});
I can submit any other relevant info and would appreciate any help or ideas.
Edit to add requested info:
image
is a personal data representation of a docker image, the only relevant thing about it is it has the name I want to tag the docker.
dockerfilefilename
again is just a string that contains the filename of the dockerfile. For example, the string "Dockerfile".
dockerClient
is an instance of DockerClient. It was created like this:
`
DockerClient dc = DefaultDockerClient.fromEnv().build();
final RegistryAuth registryAuth = RegistryAuth.builder() //TODO change to external config
.email("REDACTED")
.username("REDACTED")
.password("REDACTED")
.build();
final int statusCode = dc.auth(registryAuth);
return dc;
`
I have checked and the status code is in fact 200. I've tried many Docker commands with the driver which are successful.