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

Error: name X is already in use by container Y #1299

Closed
orodbhen opened this issue Nov 22, 2016 · 2 comments
Closed

Error: name X is already in use by container Y #1299

orodbhen opened this issue Nov 22, 2016 · 2 comments

Comments

@orodbhen
Copy link

orodbhen commented Nov 22, 2016

While using docker-py in two cron jobs, create_container() in one of them produced the error message:

APIError: 409 Client Error: Conflict ("{"message":"Conflict. The name \"/temp_cont\" is already in use by container <HASH>. You have to remove (or rename) that container to be able to reuse that name."}") 

Obviously, this was caused by using the same name for the temporary container in both jobs. However, the container doesn't exist anymore and I still get the error when running only one of the jobs manually. In fact, I even tried using a different name. So I'm not trying to name it "temp_cont" anymore, but it thinks I am. It seems to be caching the previous command somewhere.

I'm only seeing this issue using docker-py, and not using docker create or docker run from the command line. docker ps --all doesn't show a container with that hash, and it's not in /var/lib/docker/containers.

Also see the related issue in the docker repo.

@orodbhen
Copy link
Author

Turns out this was a red herring caused by my error logging framework. Closing.

@AymanRbati
Copy link

i have the same issue when i use then name attribute :
appContainer = client.containers.run(
image=imageTag,
remove=True,
stdout=False,
stderr=True,
name="appcontainer"
network_mode="host",
volumes=volumes,
privileged=True,
command=command
)

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

No branches or pull requests

2 participants