Can't remove container if it fails to start using ContainerCollection.run() #3284
Open
Description
I'm using the ContainerCollection.run()
method to run containers with the SDK but when the container fails to start (due to wrong parameters or misconfiguration on the Docker Desktop) I can't remove the dangling container since it is not returned to the user when the container.start()
call raises an APIError
nor is removed if I set the remove
flag to True
.
docker-py/docker/models/containers.py
Line 883 in a365202
I would be able to have this container removed if I set the remove
flag to True
and/or have the container reference returned to the user, enclosed within an exception might be an option.
$ pip freeze | grep docker && python --version && docker version
docker==7.0.0
Python 3.10.14
Client:
Version: 27.2.0
API version: 1.47
Go version: go1.21.13
Git commit: 3ab4256
Built: Tue Aug 27 14:14:45 2024
OS/Arch: darwin/amd64
Context: default
Server: Docker Desktop 4.34.0 (165256)
Engine:
Version: 27.2.0
API version: 1.47 (minimum version 1.24)
Go version: go1.21.13
Git commit: 3ab5c7d
Built: Tue Aug 27 14:15:15 2024
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: 1.7.20
GitCommit: 8fc6bcff51318944179630522a095cc9dbf9f353
runc:
Version: 1.1.13
GitCommit: v1.1.13-0-g58aa920
docker-init:
Version: 0.19.0
GitCommit: de40ad0
Metadata
Assignees
Labels
No labels