diff --git a/CHANGELOG.md b/CHANGELOG.md index 6113a92522..71acfa2ac4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,6 +24,7 @@ Attributes now available for all docker daemon flags as well as system IP forwar * REMOVED: container_dns* attributes (use replacement dns* attributes on daemon for all containers or docker_container dns* attributes instead) * DEPRECATED: bind_* attributes to match docker terminology (use host attribute instead) * Enhancement: [#115][]: Add IP forwarding attributes +* Enhancement: [#117][]: Docker 0.10.0: Add --output flag to docker save (as well as tag support) * Enhancement: [#118][]: Docker 0.10.0: Add --input flag to docker load * Enhancement: [#119][]: Docker 0.10.0: Add support for --env-file to load environment variables from files * Enhancement: [#124][]: Add all docker daemon options as attributes @@ -447,6 +448,7 @@ Lots of community contributions this release -- thanks! [#112]: https://github.com/bflad/chef-docker/issues/112 [#113]: https://github.com/bflad/chef-docker/issues/113 [#115]: https://github.com/bflad/chef-docker/issues/115 +[#117]: https://github.com/bflad/chef-docker/issues/117 [#118]: https://github.com/bflad/chef-docker/issues/118 [#119]: https://github.com/bflad/chef-docker/issues/119 [#124]: https://github.com/bflad/chef-docker/issues/124 diff --git a/README.md b/README.md index ff00d8cb8e..8ec02c4151 100644 --- a/README.md +++ b/README.md @@ -733,9 +733,19 @@ These attributes are associated with this LWRP action. Attribute | Description | Type | Default ----------|-------------|------|-------- -destination | Destination path | String | nil +destination | Destination path (via stdout) | String | nil +output | Destination path (via file) | String | nil -Save repository to path: +Save repository via file to path: + +```ruby +docker_image 'test' do + destination '/path/to/test.tar' + action :save +end +``` + +Save repository via stdout to path: ```ruby docker_image 'test' do diff --git a/providers/image.rb b/providers/image.rb index 4272bc67f8..e5261f1d68 100644 --- a/providers/image.rb +++ b/providers/image.rb @@ -230,7 +230,14 @@ def repository_and_tag_args end def save - docker_cmd!("save #{new_resource.image_name} > #{new_resource.destination}") + if new_resource.output + save_args = cli_args( + 'output' => new_resource.output + ) + docker_cmd!("save #{save_args} #{repository_and_tag_args}") + else + docker_cmd!("save #{repository_and_tag_args} > #{new_resource.destination}") + end end def tag diff --git a/resources/image.rb b/resources/image.rb index 0d8e779d05..000dcd61ea 100644 --- a/resources/image.rb +++ b/resources/image.rb @@ -15,6 +15,7 @@ attribute :image_url, :kind_of => [String] attribute :input, :kind_of => [String] attribute :no_cache, :kind_of => [TrueClass, FalseClass], :default => false +attribute :output, :kind_of => [String] # DEPRECATED: Use source attribute attribute :path, :kind_of => [String] attribute :registry, :kind_of => [String]