fix(config): lxc container detection (#900)

fix(config): detection for lxc containers
This commit is contained in:
Fabricio Silva 2023-05-02 17:48:12 +01:00 committed by GitHub
parent bc96979907
commit d085d894d4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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()