Skip to content

Commit

Permalink
Fix docker check. #840
Browse files Browse the repository at this point in the history
  • Loading branch information
theyosh committed Oct 11, 2023
1 parent 4c2634f commit cc7b269
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion terrariumUtils.py
Original file line number Diff line number Diff line change
Expand Up @@ -488,4 +488,13 @@ def get_translator(lang="en-US"):
@staticmethod
def is_docker():
path = "/proc/self/cgroup"
return os.path.exists("/.dockerenv") or os.path.isfile(path) and any("docker" in line for line in open(path))
if os.path.exists("/.dockerenv"):
return True

if os.path.isfile(path):
with open(path, "r") as file:
contents = file.read()

return "docker" in contents

return False

0 comments on commit cc7b269

Please sign in to comment.