shiplift icon indicating copy to clipboard operation
shiplift copied to clipboard

Container Logs example not working

Open FlowOverFail opened this issue 3 years ago • 0 comments

  • Crate version: 0.7
  • OS: Ubuntu 20.04.3 LTS
  • Output of running docker version on the command line:

Client: Docker Engine - Community Version: 20.10.9 API version: 1.41 Go version: go1.16.8 Git commit: c2ea9bc Built: Mon Oct 4 16:08:29 2021 OS/Arch: linux/amd64 Context: default Experimental: true

Server: Docker Engine - Community Engine: Version: 20.10.9 API version: 1.41 (minimum version 1.12) Go version: go1.16.8 Git commit: 79ea9d3 Built: Mon Oct 4 16:06:37 2021 OS/Arch: linux/amd64 Experimental: false containerd: Version: 1.4.11 GitCommit: 5b46e404f6b9f661a205e28d59c982d3634148f8 runc: Version: 1.0.2 GitCommit: v1.0.2-0-g52b36a2 docker-init: Version: 0.19.0 GitCommit: de40ad0

Hey guys, I cannot grab the container logs using the code from the example. It doesn't seem to print my debug message. Running docker container logs <ID> works fine as expected. Does anyone else have this issue?

let mut logs_stream = docker
        .containers()
        .get(&container.id)
        .logs(&LogsOptions::builder().stdout(true).stderr(true).build());
    
while let Some(log_result) = logs_stream.next().await {
        println!("This isn't logged");
        match log_result {
            Ok(chunk) => print_chunk(chunk),
            Err(e) => eprintln!("Error: {}", e),
        }
    }

FlowOverFail avatar Oct 24 '21 21:10 FlowOverFail