Skip to content

Startup problems on systems using SELinux (e.g. Fedora) #17

Description

@RobotLeopard86

Preamble

First off, I just wanted to say thank you, Mathew, for creating this amazing project. It's really cool! That said, I'd like to report a bug so that you can make CodeRunner even better and easier to use.

System

OS: Fedora Linux 44
Arch: x86_64
Docker: 29.7.2
Docker Compose: 2.27.1

Issue

On systems such as mine that ship with SELinux enabled, the container fails to start when following the instructions in the online local deployment guide here. Both of these failures occur before the web server is ready, which causes the healthz check in the guide to fail, saying that it couldn't connect. Two primary problems manifest here:

  1. SELinux blocks container access to the data directory containing the SQLite database that the container attempts to open.
  2. SELinux blocks the control plane container from managing student containers

Fixes

As a note, I would open this as a PR, but I really don't want to take the time to configure a fork because it's only a few changes to docker-compose.yml.

Anyways, these two issues can be resolved by applying the following Git patch:

diff --git a/data/.gitkeep b/data/.gitkeep
deleted file mode 100644
index e69de29..0000000
diff --git a/docker-compose.yml b/docker-compose.yml
index 958c655..6f00da0 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -54,7 +54,7 @@ services:
       - /var/run/docker.sock:/var/run/docker.sock
       # Compose resolves ./ against the project directory. Set
       # CODERUNNER_HOST_DATA_DIR to relocate the data dir (e.g. a mounted disk).
-      - ${CODERUNNER_HOST_DATA_DIR:-./data}:/data
+      - ${CODERUNNER_HOST_DATA_DIR:-./data}:/data:Z
     environment:
       CODE_IMAGE: ${CODERUNNER_IMAGE_NS:-ghcr.io/mathewdunne}/coderunner-workspace:${CODERUNNER_TAG:-latest}
       # Demo mode: auth bypassed, everyone shares one admin workspace. Unset
@@ -72,6 +72,8 @@ services:
       timeout: 3s
       retries: 5
       start_period: 20s
+    security_opt:
+      - label=disable
 
   # Pull-only helper: the workspace image is started by the control plane via
   # the Docker CLI, not by compose, so this stub makes `docker compose pull`

Conclusion

I hope the information provided here was informative and that this issue can be fixed relatively quickly. Again, thank you so much for creating CodeRunner. I'm happy to answer any further questions you may have about this issue.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions