Skip to content

Commit

Permalink
Docker 0.10.0: Add --output flag to docker save (as well as tag suppo…
Browse files Browse the repository at this point in the history
…rt), closes #117
  • Loading branch information
bflad committed Apr 13, 2014
1 parent de2eb7a commit 68158bc
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 3 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
14 changes: 12 additions & 2 deletions README.md
Expand Up @@ -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
Expand Down
9 changes: 8 additions & 1 deletion providers/image.rb
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions resources/image.rb
Expand Up @@ -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]
Expand Down

0 comments on commit 68158bc

Please sign in to comment.