mirror of
https://github.com/floci-io/floci.git
synced 2026-11-22 21:50:46 -05:00
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.
This commit is contained in:
1 parent
fbfe9048a1
commit
bb6f46c104
4 files changed
+17
-12
No files matched your search
@@ -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
|
||||
|
||||
+1
-1
@@ -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"
|
||||
|
||||
@@ -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 + ".";
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in new issue
Block a user