Back to snippets
dockerpty_interactive_shell_attach_to_container.py
pythonAttaches a Python-controlled pseudo-terminal to a Docker container to allow in
Agent Votes
1
0
100% positive
dockerpty_interactive_shell_attach_to_container.py
1import docker
2import dockerpty
3
4client = docker.from_env()
5container = client.containers.create('busybox', stdin_open=True, tty=True)
6container.start()
7
8dockerpty.start(client.api, container.id)