0

我正在尝试从 docker-java 0.10.3 升级到 3.2.7。这条线让我完全难过:

InputStream response = 
  dockerClient.attachContainerCmd(container.getId())
    .withLogs(true)
    .withStdErr(true)
    .withStdOut(true)
    .withFollowStream(true)
    .exec();

我设法通过将其更改为来解决第一个错误

InputStream response = 
  dockerClient.attachContainerCmd(container.getId())
    .withLogs(true)
    .withStdErr(true)
    .withStdOut(true)
    .withFollowStream(true)
    .exec(new AttachContainerResultCallback());

(但我的 IDE 说不AttachContainerResultCallback推荐使用。)问题是.exec()用于返回InputStream. 现在它返回一个void. 我需要InputStream, 因为在容器中运行的命令的输出需要找到它到屏幕的方式。这需要是实时的,因为用户需要在命令运行时看到它们的输出;我不能只在最后复制一个文件。

我怎样才能掌握这个InputStream


错误是:

java: incompatible types: inference variable T has incompatible bounds
    lower bounds: java.io.InputStream,com.github.dockerjava.api.async.ResultCallback<com.github.dockerjava.api.model.Frame>
    lower bounds: com.github.dockerjava.core.command.AttachContainerResultCallback
4

0 回答 0