Skip to content
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

Removing a container should also remove its cidfile. #164

Merged

Conversation

jperville
Copy link
Contributor

Running a named container fails when its cidfile already exists (eg. left over from a previous deployment).

How to reproduce:

vagrant@default-ubuntu-1404:~$ sudo docker run  --cidfile="/var/run/my-sample-app-0.cid" --detach=true --env-file="/etc/sample-docker-app.conf" --name="sample-docker-app-0" --publish="7022:22" --publish="7080:80" --volume="/var/log/nginx:/var/log/nginx/sample-docker-app" docker.si.perfect-memory.com/sample-docker-app:latest /sbin/my_init --enable-insecure-key
a1628f0d268404532cd19b0c8eadd2c01f8bb4558b174ebe8993ea946386e00d
vagrant@default-ubuntu-1404:~$ sudo docker rm -f sample-docker-app-0
sample-docker-app-0
vagrant@default-ubuntu-1404:~$ sudo docker run  --cidfile="/var/run/my-sample-app-0.cid" --detach=true --env-file="/etc/sample-docker-app.conf" --name="sample-docker-app-0" --publish="7022:22" --publish="7080:80" --volume="/var/log/nginx:/var/log/nginx/sample-docker-app" docker.si.perfect-memory.com/sample-docker-app:latest /sbin/my_init --enable-insecure-key
2014/06/11 15:17:32 Container ID file found, make sure the other container isn't running or delete /var/run/my-sample-app-0.cid

This PR removes the cidfile every time the container is removed (during redeploy) so that the container can be recreated safely, as suggested by the docker run error message in the above example.

@jperville jperville changed the title Removing a container also removes its cidfile. Removing a container should also remove its cidfile. Jun 11, 2014
@djdefi
Copy link

djdefi commented Jun 18, 2014

Seem to be running into this just using the redeploy action as described in the README.md example.

Container is running, make a change to the image, push to registry, and then when run chef-client again it fails to run the new docker container because the cidfile already exists. Also it seems to not be stopping the old running container.

@bflad
Copy link
Contributor

bflad commented Jun 24, 2014

This seems like a necessary fix. Thanks for the help!

bflad added a commit that referenced this pull request Jun 24, 2014
…move

Removing a container should also remove its cidfile.
@bflad bflad merged commit 6e3d9cb into sous-chefs:master Jun 24, 2014
bflad added a commit that referenced this pull request Jun 24, 2014
@jperville
Copy link
Contributor Author

Thank you very much @bflad

@jperville jperville deleted the remove-cidfile-on-container-remove branch June 24, 2014 08:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants