Using docker.client.DockerClient.containers.run with auto_remove=True causes a crash
See original GitHub issueWhat happens is straightforward: setting auto_remove=True in the arguments to run() causes the container to be removed before the Python client attempts to read the logs. This then raises an error like:
docker.errors.NotFound: 404 Client Error: Not Found ("No such container: 0e9a9dd8072a1b80ead74bc47466493ffea92eca7acf1c5f3b29ce6faf861161")
This is not how executing docker run -rm
works, where the output still goes to stdout, and it means that calling run() with auto_remove=True isn’t useful.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:2
- Comments:6 (1 by maintainers)
Top Results From Across the Web
Containers — Docker SDK for Python 6.0.1 documentation
command (str or list) – The command to run in the container. auto_remove (bool) – enable auto-removal of the container on daemon side...
Read more >Examples using the Docker Engine SDKs and Docker API
This first example shows how to run a container using the Docker API. On the command line, you would use the docker run...
Read more >What's the difference between auto_remove and remove in ...
I'm see that there are two boolean flags in client.containers.run : auto_remove (bool) – enable auto-removal of the container on daemon side ...
Read more >docker-sdk-python Documentation - Read the Docs
A Python library for the Docker Engine API. It lets you do anything the docker command does, but from within. Python apps –...
Read more >Docker client - Python on whales - GitHub Pages
from python_on_whales import docker print(docker.run("hello-world")) ... Let's say you want to use estargz to run a container immediately, without waiting ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@feliperuhland @shin- Thank you for pointing that out! I didn’t realize there is a
remove
param and the difference betweenauto_remove
. That solves my problem.+1 Minimal steps to reproduce using example from manual: