我正在学习使用docker SDK。我知道运行后需要删除容器,否则以后需要修剪。我看到client.containers.run
中有两个布尔标志:
- auto_remove (bool) – enable auto-removal of the container on daemon side when the container’s process exits.
- remove (bool) – Remove the container when it has finished running. Default: False
有什么区别?如果自动删除是on daemon side
,则删除在哪一侧?角我应该加入哪一方
参考:https://docker-py.readthedocs.io/en/stable/containers.html
事实上:
AutoRemove
确实是"create a container" Docker API call的参数之一,但是remove
选项向remove the container after it exits发送客户端库的信号设置} won't return its stderr 。如果将} ),但代码可以在退出后
auto_remove: True
可能更健壮(如果协调进程崩溃,容器仍将自行清理),但如果容器在设置该选项时失败,则^{detach: True
设置为返回Container
对象,则不能使用remove: True
(它获取converted to ^{container.remove()
返回它相关问题 更多 >
编程相关推荐