Skip to content

Commit

Permalink
Add docker kill --signal, closes #123
Browse files Browse the repository at this point in the history
  • Loading branch information
bflad committed Apr 13, 2014
1 parent f67a74c commit f890005
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ Attributes now available for all docker daemon flags as well as system IP forwar
* 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: [#120][]: Docker 0.10.0: Deprecate docker insert
* Enhancement: [#123][]: Add docker kill --signal
* Enhancement: [#124][]: Add all docker daemon options as attributes
* Enhancement: [#125][]: Use dns* attributes to set docker daemon options, not defaults per-container
* Enhancement: [#128][]: Add checksum attribute for binary downloads
Expand Down Expand Up @@ -455,6 +456,7 @@ Lots of community contributions this release -- thanks!
[#118]: https://github.com/bflad/chef-docker/issues/118
[#119]: https://github.com/bflad/chef-docker/issues/119
[#120]: https://github.com/bflad/chef-docker/issues/120
[#123]: https://github.com/bflad/chef-docker/issues/123
[#124]: https://github.com/bflad/chef-docker/issues/124
[#125]: https://github.com/bflad/chef-docker/issues/125
[#126]: https://github.com/bflad/chef-docker/issues/126
Expand Down
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,7 @@ Attribute | Description | Type | Default
cookbook | Cookbook to grab any templates | String | docker
init_type | Init type for container service handling | FalseClass, String | `node['docker']['container_init_type']`
init_template | Template to use for init configuration | String | nil
signal | Signal to send to the container | String | nil (implicitly KILL)
socket_template | Template to use for configuring socket (relevent for init_type systemd only) | String | nil

Kill a running container:
Expand All @@ -353,6 +354,15 @@ docker_container 'shipyard' do
end
```

Send SIGQUIT to a running container:

```ruby
docker_container 'shipyard' do
signal 'QUIT'
action :kill
end
```

#### docker_container action :redeploy

Stops, removes, and runs a container. Useful for notifications from image build/pull.
Expand Down
5 changes: 4 additions & 1 deletion providers/container.rb
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,10 @@ def kill
if service?
service_stop
else
docker_cmd!("kill #{current_resource.id}")
kill_args = cli_args(
'signal' => new_resource.signal
)
docker_cmd!("kill #{kill_args} #{current_resource.id}")
end
end

Expand Down
1 change: 1 addition & 0 deletions resources/container.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
attribute :remove_automatically, :kind_of => [TrueClass, FalseClass], :default => false
attribute :repository, :kind_of => [String]
attribute :run, :kind_of => [String]
attribute :signal, :kind_of => [String]
attribute :socket_template, :kind_of => [String]
attribute :source, :kind_of => [String]
attribute :status, :kind_of => [String]
Expand Down

0 comments on commit f890005

Please sign in to comment.