Comments (9)
docker_container "name" do
# ...
action :stop
end
already does the behavior you mentioned to make writing your cookbooks easy. Here's the code in case you're more curious: https://github.com/bflad/chef-docker/blob/master/providers/container.rb#L96
Let me know if you have additional questions or if its not behaving as expected.
from docker.
I just tried this:
docker_container "#{app.name}" do
action :stop
end
It doesn't appear to be working as I would expect. Here's the output I got from the test:
Recipe: deployment::none
* service[webapp] action stop
================================================================================
Error executing action `stop` on resource 'service[webapp]'
================================================================================
Errno::ENOENT
-------------
No such file or directory - /sbin/status webapp
Resource Declaration:
---------------------
# In /home/deployer/chef-solo/cookbooks-2/docker/providers/container.rb
238: service service_name do
239: case new_resource.init_type
240: when 'systemd'
241: provider Chef::Provider::Service::Systemd
242: when 'upstart'
243: provider Chef::Provider::Service::Upstart
244: end
245: supports :status => true, :restart => true, :reload => true
Compiled Resource:
------------------
# Declared in /home/deployer/chef-solo/cookbooks-2/docker/providers/container.rb:238:in `service_action'
service("webapp") do
provider Chef::Provider::Service::Upstart
action [:stop]
supports {:status=>true, :restart=>true, :reload=>true}
retries 0
retry_delay 2
service_name "webapp"
pattern "webapp"
cookbook_name :"deployment"
recipe_name "none"
end
from docker.
Which OS are you on? No such file or directory - /sbin/status
seems to imply Upstart isn't installed correctly.
from docker.
Debian 7, Linux app3 3.2.0-4-amd64 #1 SMP Debian 3.2.51-1 x86_64 GNU/Linux
from docker.
Ah yeah, Debian uses SysV (init_type sysv in this cookbook) by default. Although the docker_container sysv script is there, no one has contributed an init script for the daemon yet (guess I'll add this to my to-do list tonight). If you're stuck on using Upstart, I believe you need to install the Debian upstart
package. I'm not sure if this cookbook should handle that for you by default as it seems outside its duties.
from docker.
https://packages.debian.org/wheezy/upstart
https://packages.debian.org/wheezy/amd64/upstart/filelist
from docker.
Thanks for the good information. I am a bit hesitant on adding in upstart when I am planning on using runit, which goes along with issue #72 . Any chance you could incorporate runit into the list for docker functionalities? Thanks.
from docker.
I'm looking at all the runit documentation now. Should have an initial runit setup hopefully tonight.
from docker.
Thanks man! Definitely looking forward to it!
from docker.
Related Issues (20)
- Changelog weirdness
- Containers with embedded health checks restart on every Chef run
- Logging drivers are out of sync
- Can't stop updates to /lib/systemd/system/docker.service
- README.md is missing resources / broken links
- Setting a version causes a service restart on every run HOT 4
- docker_installation_tarball group is always reset HOT 1
- Wrong source list generation for Debian 11 HOT 8
- Use docker_image resource with build_if_missing action with buildkit
- Invalid filter 'dangling=[docker_image_prune[cleanup]]'
- docker Chef 18 compatibility HOT 7
- docker-ce package name in ubuntu 22.04 is in a different format that affects module 'docker_installation_package' HOT 1
- Can't start a simple container
- Dependency Dashboard
- docker_volume_prune resource
- Unable to use `package_name`-property of the `docker_service`-resource
- PR #1253 is a breaking change. Break on CentOS 7 (Old kernel without cgroup v2)
- ipv6 forwarding prevents the daemon to run when ipv6 is disabled in kernel
- docker_container network_mode "container:*" leads to redeploy on every chef client run
- Switch rhel platform to rhel docker-ce yum repo
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from docker.