This script reliably produces output for me on Python 2.7.11, but only about 20% of the time on Python 3.4.4 (both on Mac OS X 10.10.5): ``` python from docker import Client from docker.utils import kwargs_from_env from dockerpty import start, RunOperation, PseudoTerminal client = Client(**kwargs_from_env()) container = client.create_container('alpine', ['echo', 'hello', 'world']) operation = RunOperation( client, container['Id'], interactive=True, logs=False, ) pty = PseudoTerminal(client, operation) sockets = pty.sockets() client.start(container) pty.start(sockets) client.wait(container) ``` The last stanza is modelled on [how Compose uses dockerpty](https://github.com/docker/compose/blob/f1974f6c5e44956d1087ad6150b2e9da7c288ace/compose/cli/main.py#L951-L961). I can make the script reliable by replacing it with the following: ``` python start(client, container, interactive=True, logs=False) ``` I haven't yet investigated any further.
Activity
dnephin commentedon Jul 3, 2016
This seems like a potential race, right? Logs can be missed if they are printed before the
pty.start()connects.I'm not sure why it works with python2.
aanand commentedon Jul 5, 2016
I don't think so.
pty.sockets()opens the HTTP connections.pty.start()just hooks them up to stdin/out/err.dnephin commentedon Jul 6, 2016
Ah right, I forgot we worked that out. Thanks
cclauss commentedon Apr 11, 2017
Is this issue still open?