Docker通过远程API将图像保存为tar

我想导出一个图像到一个tar文件,我正在看docker save命令。 虽然我似乎无法在远程API中find它。

我看到远程API中的其他命令支持请求和响应中的tarstream,所以看起来应该是可能的。

这不支持,还是我错过了什么?

如果你知道ruby,你可以尝试gemdocker的API

# Export a single Docker Image to a file # docker command for reference: docker save <IMAGE.ID> my_export.tar image.save('my_export.tar') # => Docker::Image { :id => 66b712aef, :connection => Docker::Connection { :url => tcp://localhost, :options => {:port=>2375} } } 

您也可以使用它来从tar文件创build任何图像

 # Create an Image from a tar file. # docker command for reference: docker build - < docker_image.tar Docker::Image.build_from_tar(File.open('docker_image.tar', 'r')) # => Docker::Image { :id => 1266dc19e, :connection => Docker::Connection { :url => tcp://localhost, :options => {:port=>2375} } } 

参考

  1. 自述文件: swipely / docker-api