d11wtq / dockerpty

Pseudo-tty handler for docker Python client
https://github.com/d11wtq/dockerpty
Apache License 2.0
156 stars 62 forks source link

dockerpty not compatible with docker 2.4.2 #78

Open cdman opened 7 years ago

cdman commented 7 years ago

Please correct me if I'm wrong, but it's my understanding that docker-py is superseded by docker as the "official" Python Docker API binding. If so, dockerpty does not work with docker 2.4.2 and gives the following stacktrace:

Traceback (most recent call last):
  File "./build.py", line 104, in <module>
    dockerpty.start(docker_client, container)
  File ".../site-packages/dockerpty/__init__.py", line 30, in start
    PseudoTerminal(client, operation).start()
  File ".../site-packages/dockerpty/pty.py", line 328, in start
    pumps = self.operation.start(sockets=sockets)
  File ".../site-packages/dockerpty/pty.py", line 136, in start
    pty_stdin, pty_stdout, pty_stderr = sockets or self.sockets()
  File ".../site-packages/dockerpty/pty.py", line 174, in sockets
    info = self._container_info()
  File ".../site-packages/dockerpty/pty.py", line 204, in _container_info
    return self.client.inspect_container(self.container)
  File ".../site-packages/docker/client.py", line 187, in __getattr__
    raise AttributeError(' '.join(s))
AttributeError: 'DockerClient' object has no attribute 'inspect_container' In Docker SDK for Python 2.0, this method is now on the object APIClient. See the low-level API section of the documentation for more details.
piotr-piatkowski commented 6 years ago

I had the same issue, but after trying to fix module I've found it works (at least for me) when you provide docker_client.api instead of docker_client to dockerpty.start() function (and container.id instead of container, if you have an object).