我正在尝试运行以下命令:
# container started
container = PythonDockerAPIs.runContainerWithoutLogs(alpineImage, 'tail -f /dev/null', detach=True)
#execute the command
cmd1 = container.exec_run('ls -ltr',stream=True, detach=True)
有没有一种方法可以使用attach(**kwargs)
将日志附加到此容器并在以后打印日志?在
**kwargs
只是表示列出的参数是“关键字参数”,因此对于^{keyword=value
形式接受这些参数(或“参数”):stdout
(bool)–包括stdout。在stderr
(bool)–包括stderr。在stream
(bool)–以迭代器的形式逐步返回容器输出 而不是一根线。在logs
(bool)–包括容器以前的输出。在要调用此函数,请执行以下操作:
注意,文档还声明^{} 函数是}。在
attach
函数的包装器,因此可以使用该函数而不是{编辑:
完整用法示例:
^{pr2}$相关问题 更多 >
编程相关推荐