From d085d894d4719a4d267714d3d6a21406523dd6b2 Mon Sep 17 00:00:00 2001 From: Fabricio Silva Date: Tue, 2 May 2023 17:48:12 +0100 Subject: [PATCH] fix(config): lxc container detection (#900) fix(config): detection for lxc containers --- internal/config/config.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/internal/config/config.go b/internal/config/config.go index 44798b7..6bf76fc 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -107,7 +107,13 @@ func writeConfig(configPath string, configFile string) error { // docker creates a .dockerenv file at the root // of the directory tree inside the container. // if this file exists then the viewer is running - // from inside a container so return true + // from inside a docker container so return true + host = "0.0.0.0" + } else if _, err := os.Stat("/dev/.lxc-boot-id"); err == nil { + // lxc creates this file containing the uuid + // of the container in every boot. + // if this file exists then the viewer is running + // from inside a lxc container so return true host = "0.0.0.0" } else if pd, _ := os.Open("/proc/1/cgroup"); pd != nil { defer pd.Close()