#ifndef __CONTAINER_H
#define __CONTAINER_H
+
#include <stdlib.h>
+#include <stdbool.h>
+#include <sys/stat.h>
static inline bool is_container() {
- return !!getenv("container");
+ struct stat s;
+ int r = stat("/.dockerenv", &s);
+ int pv_r = stat("/pantavisor", &s);
+ return !!getenv("container") || r == 0 || pv_r == 0;
}
#endif