Your app needs different settings in Docker. You should not have to guess.
The same code runs on your laptop and in a container image. Logging paths, config files, and feature toggles often need to know which world they are in. Copy-pasting a probe from an old blog post breaks when cgroup layouts change. Wiring three different checks yourself is tedious and easy to get subtly wrong.
Docker Detector puts that decision behind one small library you can trust on the next deploy.
One question. One answer. Move on.
What you get
- A clear yes or no for Docker-style containers. The library combines more than one detection path instead of betting on a single file or cgroup line.
- Answers that stay fast when you ask repeatedly. Results are cached by default, with a way to force a fresh check when the environment may have changed mid-process.
- Nothing extra to install or audit. The package ships with zero third-party dependencies and minimal overhead.
- A familiar idea if you know the Node world. It follows the same spirit as the popular is-docker utility, ported for Python workflows.
- Free and open source. MIT licensed, published on PyPI for Python 3.8 and later.
Picture your deploy
An illustrative case: your service boots in CI, on a developer laptop, and in a compose stack. Before it picks log format or config paths, it asks whether the current process is inside Docker. Same code path everywhere, no hand-rolled probes sprinkled through the repo.






