is_running_inside_docker

Documentation for eth_defi.coloured_logging.is_running_inside_docker function.

is_running_inside_docker()

Detect whether the current process runs inside a container.

Docker and Compose logs do not usually present stdout/stderr as a TTY, but they preserve ANSI escape sequences. We use common container marker files and cgroup identifiers to enable colours for this case.

Returns

True if the process appears to run inside Docker or a compatible container runtime.

Return type

bool