You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Nov 6, 2018. It is now read-only.
I'm trying to retrieve the logs of a container which starts, executes a program which outputs to stdout, and stops. Following is the code snippet I'm using. However, I'm getting a null as the result of logHandler.getOutput(), and a NPE at line 17. However, when queried through the Docker API manually, I can get all the logs of the executed container. Appreciate any help as I'm not sure how I'd retrieve the logs from the container after calling display(), when looking at the sample code.
ContainerCreateResponsecontainer = client.container().createNew()
.withName(containerName)
.withImage(imageName)
.done();
try (
OutputHandlelogHandle = client.container().
withName(container.getId())
.logs()
.writingOutput(System.out)
.writingError(System.err)
.display()
) {
if (client.container().withName(container.getId()).start()) {
Thread.sleep(5000);
// Using Apache Commons IO to get the String.Stringoutput = IOUtils.toString(logHandle.getOutput(), "UTF-8");
client.container().withName(container.getId()).remove();
returnoutput;
}
}
The text was updated successfully, but these errors were encountered:
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
I'm trying to retrieve the logs of a container which starts, executes a program which outputs to
stdout
, and stops. Following is the code snippet I'm using. However, I'm getting a null as the result oflogHandler.getOutput()
, and a NPE at line 17. However, when queried through the Docker API manually, I can get all the logs of the executed container. Appreciate any help as I'm not sure how I'd retrieve the logs from the container after callingdisplay()
, when looking at the sample code.The text was updated successfully, but these errors were encountered: