From bb6f46c104ad4b7e57a41df5ed77495bd47c63e5 Mon Sep 17 00:00:00 2001 From: soreavis <263610811+soreavis@users.noreply.github.com> Date: Tue, 3 Nov 2026 19:17:49 +0100 Subject: [PATCH] fix(docker): recommend label=disable, not :z, when SELinux blocks the Podman socket (#7434) The Podman docs and the web console's start-failure message told SELinux users to relabel the socket mount with :z. On a rootless podman machine (SELinux enforcing) that recipe fails: the web console cannot start and a Lambda invoke returns "Docker is not reachable (Permission denied)". :z fixes access to the socket file, but SELinux also denies connectto from the Floci container (container_t) to the Podman service (container_runtime_t), which a relabel can't fix; --security-opt label=disable avoids it. With it, the same recipe starts the console and invokes a Python Lambda. --- docs/configuration/docker.md | 19 ++++++++++--------- docs/ui/index.md | 2 +- .../services/floci/ui/FlociUiManager.java | 4 ++-- .../services/floci/ui/FlociUiManagerTest.java | 4 ++++ 4 files changed, 17 insertions(+), 12 deletions(-) diff --git a/docs/configuration/docker.md b/docs/configuration/docker.md index dbe3b7b6f7..c4cf614755 100644 --- a/docs/configuration/docker.md +++ b/docs/configuration/docker.md @@ -287,7 +287,8 @@ podman network create floci-net podman run -d --name floci \ --network floci-net \ -p 4566:4566 \ - -v /run/user/$(id -u)/podman/podman.sock:/var/run/docker.sock:z \ + -v /run/user/$(id -u)/podman/podman.sock:/var/run/docker.sock \ + --security-opt label=disable \ -e FLOCI_SERVICES_LAMBDA_DOCKER_NETWORK=floci-net \ -e FLOCI_HOSTNAME=floci \ floci/floci @@ -302,14 +303,14 @@ What each setting does and why it is needed: Lambda containers it spawns to that same named network. - **`FLOCI_HOSTNAME=floci`** — gives Floci a stable name that Lambda containers resolve when calling back to the Runtime API. -- **`:z` on the socket mount** — relabels the Podman socket for SELinux. Without - it, Floci fails to talk to the Podman socket: Lambda/ECR container creation - errors with `java.io.IOException: Broken pipe`, and the **Floci UI** sidecar - fails to launch with `java.net.BindException: Permission denied`. Use the - lowercase `:z` (shared relabel) rather than `:Z` — the Podman API socket is - shared with the Podman service, and `:Z` applies a container-private SELinux - label that can break access. If `:z` is still not enough on your host, fall - back to `--security-opt label=disable`. +- **`--security-opt label=disable`**: turns off SELinux labeling for the Floci + container. With SELinux enforcing, the container's label keeps Floci from + talking to the Podman socket: Lambda/ECR container creation fails with + `java.net.BindException: Permission denied` (or + `java.io.IOException: Broken pipe`), and so does the **Floci UI** sidecar. + Relabeling the mount with `:z` or `:Z` is not a substitute: it fixes access to + the socket file, but SELinux also denies `connectto` on the Podman service at + the other end of the socket. !!! tip "When the Runtime API address is still unreachable" On some Podman network topologies the auto-detected Runtime API address diff --git a/docs/ui/index.md b/docs/ui/index.md index e52e5cb93e..124c7ff031 100644 --- a/docs/ui/index.md +++ b/docs/ui/index.md @@ -161,7 +161,7 @@ previous run that it is pointing at a dead address. !!! note "The page says Floci could not reach the container runtime" Floci needs the Docker socket. Check that `/var/run/docker.sock` is mounted into the Floci - container. On SELinux hosts the bind-mount may need relabeling (`:z`) or + container. On SELinux hosts, start the Floci container with `--security-opt label=disable`. See [Docker Configuration](../configuration/docker.md). !!! note "The console loads but says it cannot reach Floci" diff --git a/src/main/java/io/github/hectorvent/floci/services/floci/ui/FlociUiManager.java b/src/main/java/io/github/hectorvent/floci/services/floci/ui/FlociUiManager.java index 14f133d1b9..baff3c291f 100644 --- a/src/main/java/io/github/hectorvent/floci/services/floci/ui/FlociUiManager.java +++ b/src/main/java/io/github/hectorvent/floci/services/floci/ui/FlociUiManager.java @@ -851,8 +851,8 @@ public class FlociUiManager { return "Could not start the Floci web console: Floci could not reach the container runtime (" + detail + "). Check that the Docker/Podman socket is mounted into the Floci container and " - + "accessible — on SELinux hosts the socket bind-mount may need relabeling " - + "(e.g. ':z') or '--security-opt label=disable'."; + + "accessible. On SELinux hosts, start the Floci container with " + + "'--security-opt label=disable'."; } return "Could not start the Floci web console from image '" + image + "': " + detail + "."; } diff --git a/src/test/java/io/github/hectorvent/floci/services/floci/ui/FlociUiManagerTest.java b/src/test/java/io/github/hectorvent/floci/services/floci/ui/FlociUiManagerTest.java index 442564028e..0d57e960a4 100644 --- a/src/test/java/io/github/hectorvent/floci/services/floci/ui/FlociUiManagerTest.java +++ b/src/test/java/io/github/hectorvent/floci/services/floci/ui/FlociUiManagerTest.java @@ -324,6 +324,10 @@ class FlociUiManagerTest { "socket-permission failure must not be reported as a missing image, was: " + msg); assertTrue(msg.contains("could not reach the container runtime"), msg); assertTrue(msg.contains("Permission denied"), msg); + // A ':z' relabel only fixes access to the socket file; SELinux still denies connectto + // on the Podman service, so the message must not send users back to it. + assertTrue(msg.contains("'--security-opt label=disable'"), msg); + assertFalse(msg.contains(":z"), msg); } @Test