Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Detect lxc #1754

Merged
merged 4 commits into from
May 26, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 6 additions & 0 deletions supervisor/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,12 @@ async def connect(self):
"Docker version %s is not supported by Supervisor!",
self.sys_docker.info.version,
)
elif self.sys_docker.info.inside_lxc:
self.healthy = False
_LOGGER.critical(
"Detected Docker running inside LXC. Running Home Assistant with the Supervisor on LXC is not supported!"
)

self.sys_docker.info.check_requirements()

# Check if system is healthy
Expand Down
6 changes: 6 additions & 0 deletions supervisor/docker/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from contextlib import suppress
from ipaddress import IPv4Address
import logging
from pathlib import Path
from typing import Any, Dict, Optional

import attr
Expand Down Expand Up @@ -46,6 +47,11 @@ def supported_version(self) -> bool:

return version_local >= version_min

@property
def inside_lxc(self) -> bool:
"""Return True if the docker run inside lxc."""
return Path("/dev/lxd/sock").exists()

def check_requirements(self) -> None:
"""Show wrong configurations."""
if self.storage != "overlay2":
Expand Down