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

Duplicate container is left over when recreate fails #1573

Closed
lieryan opened this issue Jun 19, 2015 · 8 comments
Closed

Duplicate container is left over when recreate fails #1573

lieryan opened this issue Jun 19, 2015 · 8 comments
Assignees
Labels
Milestone

Comments

@lieryan
Copy link

lieryan commented Jun 19, 2015

This is related to #1045. After hitting the issue mentioned in #1045, subsequent docker-compose up fails with:

$ sudo docker-compose up -d
Recreating foo_bar_1...
Traceback (most recent call last):
...
requests.exceptions.ReadTimeout: UnixHTTPConnectionPool(host='localhost', port=None): Read timed out. (read timeout=60)
$ sudo DOCKER_CLIENT_TIMEOUT=300 docker-compose up
Recreating foo_bar_1...
Recreating 9c1b31a841_foo_bar_1...
Conflict. The name "foo_bar_1" is already in use by container 4af37fe03b76. You have to delete (or rename) that container to be able to reuse that name.
@szuliq
Copy link

szuliq commented Jun 19, 2015

I also see a lot of these.

I'm not sure if those are caused by #1045

Ubuntu 15.04; Docker 1.7

@aanand
Copy link

aanand commented Jun 19, 2015

Looks related to #1349 - Compose has somehow gotten into a situation where there are two containers with the suffix _1, one of which has been renamed but then failed to recreate (perhaps because there was an HTTP timeout).

@dnephin
Copy link

dnephin commented Jun 19, 2015

I think after the failure, 9c1b31a841_foo_bar_1 still has the correct labels, so it's still considered an instance of the service. So there are two instances with the id of 1.

compose would need to only recreate once per instance id. In many ways this is related to #1516.

@aanand
Copy link

aanand commented Jun 19, 2015

OK yeah, looks like this happens if we successfully create the new container but fail to start it. I can reproduce by sticking a sys.exit() in recreate_container:

new_container = self.create_container(...)
sys.exit(1)
self.start_container(new_container)

This results in a renamed old container, plus an unstarted new container, both with container-number=1.

In many ways this is related to #1516.

Random container numbers would solve the immediate error, yeah, but we'd still be left with two containers where we only wanted one.

@DavidBruant
Copy link

I also see a lot of these.

Ubuntu 15.04; Docker 1.7

Same combination, same problem. I also doubt it's #1045

I could get back to work by coming back to Docker 1.4.1 and docker-compose 1.2.0.

@lieryan
Copy link
Author

lieryan commented Jun 29, 2015

This bug seems to show up if there is an exception (e.g. with #1045) or if you Ctrl+C in the middle of a docker-compose up. Essentially, docker-compose fails to clean up the temporary containers.

@iMerica
Copy link

iMerica commented Jul 2, 2015

Which version can I downgrade to so that I can get around this issue?

@aanand
Copy link

aanand commented Jul 3, 2015

@iMerica Run docker-compose rm -f to clear everything out, then downgrade to 1.2.0.

@aanand aanand added this to the 1.3.1 milestone Jul 3, 2015
@aanand aanand changed the title Ghost container name is already in use Duplicate container is left over when recreate fails Jul 3, 2015
@aanand aanand self-assigned this Jul 3, 2015
@aanand aanand modified the milestones: 1.3.1, 1.3.2 Jul 3, 2015
@aanand aanand removed the in progress label Jul 3, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants