-
Notifications
You must be signed in to change notification settings - Fork 0
usage
github-actions[bot] edited this page Apr 12, 2026
·
4 revisions
Quick reference for running the Raylib Docker container on Linux.
Home: Home
Prerequisites
- Allow containers to access the display:
# Allow connections from Docker on the current graphical session
xhost +local:docker- (Optional) Add your user to the
dockergroup to avoidsudo:
sudo usermod -aG docker $USERBuilding the image (if needed)
docker build -t raylib_container .Running the container
Hardware-accelerated (recommended):
docker run -it --rm \
-e DISPLAY=$DISPLAY \
-v /tmp/.X11-unix:/tmp/.X11-unix \
-v ./user_code:/app/user_code \
--device /dev/dri:/dev/dri \
raylib_containerSoftware rendering (fallback):
docker run -it --rm \
-e DISPLAY=$DISPLAY \
-v /tmp/.X11-unix:/tmp/.X11-unix \
-v ./user_code:/app/user_code \
-e LIBGL_ALWAYS_SOFTWARE=1 \
raylib_containerVerify graphics connection
Inside the container, run:
xeyesDeveloping inside the container
Place your source in the host user_code directory (mounted as /app/user_code). Example compile inside the container:
cd /app/user_code
gcc my_game.c -o my_game -lraylib -lGL -lm -lpthread -ldl -lrt -lX11
./my_gameReverting host changes
- Revoke display access:
xhost -local:docker - Remove user from docker group (if added):
sudo gpasswd -d $USER docker
Troubleshooting
- "Cannot connect to the Docker daemon": verify docker group membership or use
sudo. - "cannot open display": ensure
xhost +local:dockerran in the current graphical session and thatDISPLAYis passed. - Hardware acceleration errors (MESA/drm): try the software rendering command above.
For more details and platform-specific notes see overview.md.
Wiki links: Home overview macos/compatibility windows/usage