Description
I'm sorry, this has been beaten a few times, but I can't find anything that I can understand on how to make the stdin work properly.
java-docker: 3.2.11
docker: ce-20.10.3-3.fc31
In short, it seems that the stdin stream used in exec
command never closes. This seems to be the same as #1315 .
I've tried OkDockerHttpClient
and Apache clients, with the same result. Jersey client fails with "Does not support hijacking", which is, AFAIU, expected.
The discussions in relevant issues all mention using Netty, but I don't understand how I can hook it up now.
DockerClientBuilder.withDockerCmdExecFactory()
has been deprecated, and I don't see any other classes in netty-transport package that are exposed to the application. Using netty cmd factory does help (the command finishes properly), but since that mechanism is deprecated, I assume I'm not supposed to use it.
I've created a sample workspace that reproduces the issue for me: https://github.com/veselov/DockerTest
Relevant code:
ExecCreateCmdResponse execCmd = docker
.execCreateCmd(containerId)
.withCmd("cat")
.withAttachStdin(true)
.withAttachStdout(true)
.withAttachStdin(true)
.exec();
AnyResultCallBack<Frame> cb = docker
.execStartCmd(execCmd.getId())
.withStdIn(new MyStream())
.exec(makeLogResult());
cb.awaitCompletion();
Strace on the container shows cat
reading from 0
, and the docker web-service is waiting for data.