0
我正在使用docker python API从Dockerfile构建图像。如何在docker python API中传输日志?
import os
import sys
import os.path
import docker
client = docker.from_env()
try:
here = os.path.dirname(__file__)
no_cache = False
dockerfile = os.path.join(here, 'app', 'nextdir')
image = client.images.build(path=dockerfile, tag='app:v.2.4', nocache=no_cache, stream=True)
操作成功完成,但是我无法流式传输日志。该API说:
返回阻塞发生器可以遍历检索建设 输出,因为它发生
当流=真。
如何在Python中获取这些日志?