docker-py icon indicating copy to clipboard operation
docker-py copied to clipboard

Docker Logs Stream

Open ruscott2009 opened this issue 3 years ago • 0 comments

I want to stream a running containers stdout logs to my interpreter however the logs don't appear when the container is running. When the container finishes all the logs are printed at once. Any ideas where I can start to troubleshoot this issue? I’m using dockerpy 5.0.3 and Docker Desktop 4.7.1. Thank you in advance.

client = docker.from_env() container = client.containers.run( "ptcloud2ptcloud:latest", command=["/bin/bash", "-c", cmd], volumes=volumes, detach=True, remove=True, stdout=True, stderr=True, cpu_count=7, mem_limit='16g',

)

print("container submitted") for line in container.logs(stream=True): print(line.strip())

ruscott2009 avatar Apr 29 '22 20:04 ruscott2009