Docker-py: Client.Api Remove Container always returns Conflict

Created on 27 Aug 2018  路  1Comment  路  Source: docker/docker-py

Hi,
I am trying to start a container, get a particular file and delete the container again,
but I always get this error: "Conflict, cannot remove the default name of the container"
Newest Docker-py Version, running on Windows
Code:

    container = client.containers.run("busybox:latest, "echo test", detach=True)
    client.api.wait(container.id)
    try:
       pass # in reality rip a file from the container

    finally:
        client.api.remove_container(container .id, True, True) # ERROR

Thx!

kinquestion

Most helpful comment

In your call to remove_container, you're setting link=True, which is probably not what you're looking to do.

        link (bool): Remove the specified link and not the underlying
            container

Try container.remove(v=True, force=True) instead.

>All comments

In your call to remove_container, you're setting link=True, which is probably not what you're looking to do.

        link (bool): Remove the specified link and not the underlying
            container

Try container.remove(v=True, force=True) instead.

Was this page helpful?
0 / 5 - 0 ratings