dockerpty icon indicating copy to clipboard operation
dockerpty copied to clipboard

dockerpty not compatible with docker 2.4.2

Open cdman opened this issue 8 years ago • 1 comments

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.

cdman avatar Jul 14 '17 08:07 cdman

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).

piotr-piatkowski avatar Dec 05 '17 07:12 piotr-piatkowski