spotify / docker-client

INACTIVE: A simple docker client for the JVM
Apache License 2.0
1.43k stars 549 forks source link

[question] ExecState value failed: Null exitCode ispecting a running exec #748

Closed andreavavassori closed 7 years ago

andreavavassori commented 7 years ago

Im getting a JsonMappingException : Instantiation of [simple type, class com.spotify.docker.client.messages.ExecState] value failed: Null exitCode

when I try inspecting a running exec.

final ExecCreation execCreation = dockerClient.execCreate( containerId, command, DockerClient.ExecCreateParam.attachStderr(),DockerClient.ExecCreateParam.attachStdout());
dockerClient.execStart(execCreation.id());
//            Thread.sleep(10000);
final ExecState state = dockerClient.execInspect(execCreation.id());

during the exec execution is normal that the exitCode is null, if I put the sleep and wait the exec terminarion the inspect work correctly. so, how I can know when the execution is end without an execInspect?

in the first version of my code I use the

final LogStream output = docker.execStart(execCreation.id());
String execOutput = output.readFully();

before do inspect, so I know there the exec is terminate but due #513 Y cannot use the readFully() method.

How I can know when the exec run is end get the exit code without put a sleep? thanks in advance

davidxia commented 7 years ago

This was a bug fixed by https://github.com/spotify/docker-client/pull/680. You can inspect non-exited containers without error in the recent versions of docker-client.