=============== LIBRARY RULES =============== From library maintainers: - Import is_docker from docker_detector. It always returns False on macOS and Windows; use container-detect for Podman or Kubernetes. - The result is cached; call is_docker(force_refresh=True) to check again. ### Install docker-detector with pip Source: https://github.com/ysskrishna/docker-detector/blob/main/README.md Install the docker-detector package using pip. ```bash pip install docker-detector ``` -------------------------------- ### Install docker-detector with uv Source: https://github.com/ysskrishna/docker-detector/blob/main/README.md Install the docker-detector package using uv. ```bash uv add docker-detector ``` -------------------------------- ### is_docker API example Source: https://github.com/ysskrishna/docker-detector/blob/main/README.md Example from the API reference showing is_docker() calls with and without force_refresh. Linux-only detection; returns False on macOS and Windows. ```python from docker_detector import is_docker is_docker() # False (Uses cache) is_docker(force_refresh=True) # False (Bypasses cache) ``` -------------------------------- ### Force refresh cache with is_docker(force_refresh=True) Source: https://github.com/ysskrishna/docker-detector/blob/main/README.md Demonstrates using is_docker() with default caching and forcing a fresh check with force_refresh=True. ```python from docker_detector import is_docker # Use cached result (default) is_docker() # Fast, uses cache # Force a fresh check, bypassing cache is_docker(force_refresh=True) # Performs new detection ``` -------------------------------- ### Check if running inside Docker Source: https://github.com/ysskrishna/docker-detector/blob/main/README.md Use is_docker() to detect if the current process runs inside a Docker container. Prints a message accordingly. ```python from docker_detector import is_docker if is_docker(): print("Running inside a Docker container") else: print("Not running inside a Docker container") ``` -------------------------------- ### is_docker(force_refresh: bool = False) -> bool Source: https://github.com/ysskrishna/docker-detector/blob/main/README.md Returns True if the current process is running inside a Docker container. Linux-only detection; returns False on macOS and Windows. Optionally bypasses the cache with force_refresh. ```APIDOC ## is_docker(force_refresh: bool = False) -> bool ### Description Returns True if the current process is running inside a Docker container. Linux-only detection; returns False on macOS and Windows. Optionally bypasses the cache with force_refresh. ### Parameters - `force_refresh` (bool) - Optional - If True, bypass the cache and perform a fresh check. Defaults to False. ### Returns - True if running inside Docker, False otherwise. ### Example ```python from docker_detector import is_docker is_docker() # False (Uses cache) is_docker(force_refresh=True) # False (Bypasses cache) ``` ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.