Skip to content

'None' timeout breaks with Client.stop #649

@ruiztulio

Description

@ruiztulio

Hi,

We are wotking on a script to automate some stuff using docker and docker-py in some point we execute some code inside docker, this command can take from a few minutes to a 5 or 6 hours.

I realized that I could do something like this:

container_name = 'container_name_or_id'
cli = Client(timeout=None)
output = cli.execute(container_name, 'ls')

And works as expected, but then the container have to be stopped and started (here I just put the specific code for a PoC):

from docker import Client

container_name = 'container_name_or_id'
cli = Client(timeout=None)

# Here goes a command that take a lot of time, not just a ls
output = cli.execute(container_name, 'ls')
cli.stop(container_name)
# Do some more stuff
cli.start(container_name)

But we get this:

Traceback (most recent call last):
  File "test_resume.py", line 48, in <module>
    cli.stop(container_name)
  File "/home/truiz/deployer/venv/lib/python2.7/site-packages/docker/client.py", line 923, in stop
    timeout=(timeout + self.timeout))
TypeError: unsupported operand type(s) for +: 'int' and 'NoneType'

Is there any other way of setting an "infinite" timeout? or just no timeout for this long runnig scripts?

Regards

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions