canonical / canonical/dotrun

Docker error about name conflict

Open
#105 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
40
Forks
18
PR merge metrics
No merged PRs in 30d

Description

For some reason I was getting an error about name conflict even that no other `dotrun` instance was running at a time:

```
~/Canonical/anbox-cloud.io [main] $ dotrun
Checking for dotrun image updates...
Traceback (most recent call last):
File "/Users/bartaz/Library/Python/3.8/lib/python/site-packages/docker/api/client.py", line 268, in _raise_for_status
response.raise_for_status()
File "/Users/bartaz/Library/Python/3.8/lib/python/site-packages/requests/models.py", line 1021, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 409 Client Error: Conflict for url: http+docker://localhost/v1.41/containers/create?name=dotrun-anbox-cloud.io

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/local/bin/dotrun", line 8, in
sys.exit(cli())
File "/Library/Python/3.8/site-packages/dotrun.py", line 129, in cli
container = dotrun.create_container(command)
File "/Library/Python/3.8/site-packages/dotrun.py", line 107, in create_container
return self.docker_client.containers.create(
File "/Users/bartaz/Library/Python/3.8/lib/python/site-packages/docker/models/containers.py", line 878, in create
resp = self.client.api.create_container(**create_kwargs)
File "/Users/bartaz/Library/Python/3.8/lib/python/site-packages/docker/api/container.py", line 428, in create_container
return self.create_container_from_config(config, name)
File "/Users/bartaz/Library/Python/3.8/lib/python/site-packages/docker/api/container.py", line 439, in create_container_from_config
return self._result(res, True)
File "/Users/bartaz/Library/Python/3.8/lib/python/site-packages/docker/api/client.py", line 274, in _result
self._raise_for_status(response)
File "/Users/bartaz/Library/Python/3.8/lib/python/site-packages/docker/api/client.py", line 270, in _raise_for_status
raise create_api_error_from_http_exception(e)
File "/Users/bartaz/Library/Python/3.8/lib/python/site-packages/docker/errors.py", line 31, in create_api_error_from_http_exception
raise cls(e, response=response, explanation=explanation)
docker.errors.APIError: 409 Client Error for http+docker://localhost/v1.41/containers/create?name=dotrun-anbox-cloud.io: Conflict ("Conflict. The container name "/dotrun-anbox-cloud.io" is already in use by container "931abce5c5396d440b64f0d0a654b76d58ca2648bfc9d06533e1763c7692f360". You have to remove (or rename) that container to be able to reuse that name.")
```

I fixed it by manually deleting container with "anbox-cloud" in the name.

Not sure what could cause that issue.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the dotrun.py cli() and create_container() entry points shown in the traceback, then reproduce the Docker name conflict with the reported dotrun-anbox-cloud.io container name. Done means repeated dotrun use no longer fails because an old container retains that name, or the failure is clearly explained and handled.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, python
Domain
cli, devops
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.