How to get the docker container logs using docker-java client library

I tried the following code but the response contains an object instead of logs.

    DockerClientConfig config = DefaultDockerClientConfig.createDefaultConfigBuilder()
       .withDockerHost("tcp://IP:PORT").withDockerTlsVerify(true)
       .withDockerCertPath("...........CERTIFICATE PATH..........").build();

    DockerClient dockerClient = DockerClientBuilder.getInstance(config).build();
    dockerClient.logContainerCmd("Container ID")
                                 .withStdOut(true).withFollowStream(true)
                                 .exec();

  • bitbucket docker Permission denied (publickey). fatal: Could not read from remote repository
  • How to get Image ID of docker in jenkins?
  • Cannot Access Docker Phpmyadmin via Port
  • How can I gdb attach to a process running in a docker container?
  • Connection to docker container failing because of postgis port issue
  • edit docker container files with OS X Sublime Text
  • Configuring Spark Job Server to work with cluster
  • docker daemon start using ansible
  • What is the proper endpoint for connecting to azure container service swarm cluster from c# https://github.com/Microsoft/Docker.DotNet
  • Docker - Cannot execute multiple docker run commands from same .sh file
  • Docker-Compose - Restart my reverse proxy automatically in case of image update
  • Can I connect directly to a docker swarm network?
  • Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.