detects if running in a docker container, which then requires special treatment of mounts. OpenWrt within Docker is useful for CI testing. Signed-off-by: Paul Spooren <mail@aparcar.org>
@@ -16,9 +16,11 @@
#include <stdlib.h>
#include <stdbool.h>
+#include <sys/stat.h>
static inline bool is_container() {
- return !!getenv("container");
+ struct stat s;
+ return !!getenv("container") || !!stat("/.dockerenv", &s);
}
#endif