Describes whether the current process is running in a container runtime.
| 13 | |
| 14 | @dataclass(frozen=True) |
| 15 | class RuntimeEnvironment: |
| 16 | """Describes whether the current process is running in a container runtime.""" |
| 17 | |
| 18 | in_container: bool |
| 19 | in_docker: bool |
| 20 | in_kubernetes: bool |
| 21 | |
| 22 | @property |
| 23 | def label(self) -> str: |
| 24 | if self.in_kubernetes: |
| 25 | return "Kubernetes" |
| 26 | if self.in_docker: |
| 27 | return "Docker" |
| 28 | return "host" |
| 29 | |
| 30 | |
| 31 | def _read_cgroup_content() -> str: |
no outgoing calls