-
Notifications
You must be signed in to change notification settings - Fork 63
Open
Labels
Description
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):
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. I can make the script reliable by replacing it with the following:
start(client, container, interactive=True, logs=False)I haven't yet investigated any further.