-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Description
The following code works with python2, but throws error on python3:
import docker
files = [open('/tmp/test_' + str(i), 'w+b') for i in range(0, 1024)]
client = docker.from_env()
cnt = client.containers.run("ubuntu:18.04", command="sleep 10", detach=True, auto_remove=True)
cnt.exec_run("ls -ls")
Output:
cnt.exec_run("ls -ls")
File "/usr/lib/python3/dist-packages/docker/models/containers.py", line 185, in exec_run
resp['Id'], detach=detach, tty=tty, stream=stream, socket=socket
File "/usr/lib/python3/dist-packages/docker/utils/decorators.py", line 19, in wrapped
return f(self, resource_id, *args, **kwargs)
File "/usr/lib/python3/dist-packages/docker/api/exec_api.py", line 165, in exec_start
return self._read_from_socket(res, stream, tty)
File "/usr/lib/python3/dist-packages/docker/api/client.py", line 377, in _read_from_socket
return six.binary_type().join(gen)
File "/usr/lib/python3/dist-packages/docker/utils/socket.py", line 75, in frames_iter
n = next_frame_size(socket)
File "/usr/lib/python3/dist-packages/docker/utils/socket.py", line 62, in next_frame_size
data = read_exactly(socket, 8)
File "/usr/lib/python3/dist-packages/docker/utils/socket.py", line 47, in read_exactly
next_data = read(socket, n - len(data))
File "/usr/lib/python3/dist-packages/docker/utils/socket.py", line 27, in read
select.select([socket], [], [])
ValueError: filedescriptor out of range in select()
if socket has fd > 1024, select will fail
Stack Overflow suggests using poll() in place of select(), as it's not bound by 1024 fd limit.
Environment :
ubuntu: 18.04
docker: 18.09.3
docker API: 1.39
python: 3.6.7
docker-py: 3.7.0
ChrisTimperley, khood5, oraluben, tavplubix and dismantl
Metadata
Metadata
Assignees
Labels
No labels