skillfed

dockerpty

Python library to use the pseudo-tty of a docker container

dockerpty v0.4.1 706.8K downloads/30d#5,271 on PyPI161
Permissive license Apache 2.0 Abandoned released

What it is and what it does

dockerpty is a Python library that bridges the gap between a host terminal and a Docker container's pseudo-terminal (PTY), allowing you to run interactive shell sessions inside containers as if you were directly connected to them. It handles the low-level details of terminal control: piping stdin/stdout/stderr between host and container, managing raw terminal mode, handling window resize signals, and restoring terminal state on exit.

The library is designed for scenarios where you need programmatic, interactive access to a container's shell from Python. It also supports non-TTY attachment for streaming container output. However, the project is abandoned (last release 2016-02-04, no commits since 2019-10-16) and does not explicitly declare its runtime dependency, creating friction for new installations and raising questions about compatibility with modern tooling.

Use it for:

  • Run interactive shell sessions inside Docker containers from Python scripts, giving users direct terminal control.
  • Implement programmatic container debugging or administration tools that need real-time terminal interaction.
  • Stream container output in non-TTY mode when interactive control is not required.
  • Detach from and re-attach to running containers without stopping them.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Operates the pseudo-terminal (PTY) allocated to a Docker container, enabling interactive terminal control of containerized processes from Python.

No. The package is abandoned (last release 2016-02-04, no commits since 2019-10-16) and does not explicitly declare its runtime dependency, creating installation friction and compatibility risk. Modern Docker tooling has evolved significantly since then. Consider using maintained alternatives or the official Docker SDK for interactive container control.

Install

dockerpty on PyPI

pip

pip install dockerpty

uv

uv add dockerpty

poetry

poetry add dockerpty

Installing dockerpty

Before you install

High install friction: the package does not explicitly declare its runtime dependency in PyPI, requiring manual installation. Maintenance is abandoned—last release was 2016-02-04, with no commits since 2019-10-16.

License in practice

Licensed under Apache 2.0 (permissive), allowing commercial and private use with minimal restrictions, though you should review the LICENSE.txt file for exact terms.

Quickstart

pip install dockerpty

import dockerpty

dockerpty.start(client, container)

Requires an undeclared external dependency (docker-py >=0.3.2); only works when run in an actual terminal; requires Docker daemon running locally.

Verify before relying

  • Compatibility with modern Docker SDK versions—last release predates major Docker API changes.
  • Python version support—requires_python is unspecified; may not work on modern Python versions.
  • Whether the undeclared dependency is still the correct package name or has been superseded.
  • Current usability with contemporary Docker tooling and container runtimes.

Package facts

License Apache 2.0 (permissive)
Python support not specified
Install friction high — source build required
Runtime dependencies none
Maintenance abandoned — 3,844 days since the last release
Last repo commit
First released
Downloads 706,753/month — #5,271 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: dockerpty-0.4.1.tar.gz

Keywords: docker, tty, pty, terminal

Development Status :: 4 - BetaEnvironment :: ConsoleIntended Audience :: DevelopersLicense :: OSI Approved :: Apache Software LicenseProgramming Language :: PythonTopic :: Software Development :: LibrariesTopic :: Software Development :: Libraries :: Python ModulesTopic :: TerminalsTopic :: Terminals :: Terminal Emulators/X Terminals

Tags

docker container terminal controldocker pty pseudo-terminalinteractive docker shell pythondocker tty attachmentcontainer stdin stdout stderrdocker terminal emulationdocker interactive mode python
docker-integrationterminal-controlabandoned

More Libraries packages