-
-
Notifications
You must be signed in to change notification settings - Fork 791
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
docker_container with action :run not idempotent #184
Comments
It's worth noting that the link parameter causes the resulting container name to be different than the name parameter. See here for example:
On these grounds I am looking at this section of the code for the source of the bug: https://github.com/bflad/chef-docker/blob/master/providers/container.rb#L152-L168 |
I'm running into this issue too, and it gave me some grief. It stems from the :run action creating a new service. In the docs: "By default, this will handle creating a service for the container when action is run or start." In other words, an init script is created. Because an init script is created, the container_name must be constant, so the container_name is pre-populated for the https://github.com/bflad/chef-docker/blob/master/providers/container.rb#L162 But we can turn that off by: "set['docker']['container_init_type'] = false or add init_type false for LWRP to disable this behavior." (from the docs) That solved the issue for me. I think this behavior is unexpected and that |
@mikexstudios I think we might be describing different issues. In my case, an upstart service is desired, and the error I'm experiencing on second converge is coming from Chef, not upstart, trying to run I think the init script behavior you describe may be a separate bug, because when I manually run PR #185 prevents Chef from trying to run the |
@bplunkert Ah, I see. Thanks for clarifying. |
Should be fixed via #185, created #191 to add test cases. @mikexstudios please create another issue if it makes sense for your problem. Thanks! |
I'm still experiencing this problem. I've thrown a demonstration up at https://github.com/benlangfeld/docker_bug_demo. Every time the image is updated on the registry, I get an error that looks like this:
It seems that nothing is stopping/deleting the existing container. Does anyone know why this might be? |
I guess what I'm seeing is the same as #194 (comment) |
A container resource with a service without an explicit `container_name` attribute was not idempotent. Checking the running state of the container by name requires lookup by the same name assumed at launch time, which in this case is some default value. See sous-chefs#184 (comment)
The docker_container resource successfully starts up a container on Ubuntu 14.04, but upon a second converge, the container resource attempts to execute docker run despite the container already running. The issue is reproducible with the following code:
The error produced is the following:
Possibly there is a bug with the running? method here: https://github.com/bflad/chef-docker/blob/master/providers/container.rb#L355-L357
The text was updated successfully, but these errors were encountered: