Skip to content

Commit 1cb5fe8

Browse files
authored
Catch Ubuntu's snap-based Docker runtime (#118)
1 parent 11288e9 commit 1cb5fe8

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

src/checkers/preinstall/system.rs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ impl SystemChecks {
2727
}
2828
pub async fn run_all(&self) -> CheckGroupResult {
2929
let results = join_all([
30+
self.not_snap_docker().boxed(),
3031
self.enough_memory().boxed(),
3132
self.enough_disk("/usr".into(), MINIMUM_DISK_GENERAL)
3233
.boxed(),
@@ -60,6 +61,24 @@ impl SystemChecks {
6061
}
6162
}
6263

64+
async fn not_snap_docker(&self) -> CheckResult {
65+
let name = String::from("Supported Docker Runtime");
66+
let is_snap = std::fs::read_to_string("/proc/self/mountinfo")
67+
.map(|c| c.contains("snap/docker"))
68+
.unwrap_or(false);
69+
70+
if is_snap {
71+
CheckResult::new(
72+
&name,
73+
Errored(
74+
"Docker is running as a snap: hosts with snap-managed Docker runtimes are not supported installation targets".into(),
75+
),
76+
)
77+
} else {
78+
CheckResult::new(&name, Passed)
79+
}
80+
}
81+
6382
/// Checks that the `nft` binary, typically from the `nftables` package,
6483
/// is in PATH. Currently, the installer and `protect-network` rely on this.
6584
async fn has_nft_bin(&self) -> CheckResult {

0 commit comments

Comments
 (0)