Skip to main content

Raylib Container

A containerized development environment for game development using Raylib on Docker with hardware acceleration and software rendering options.

Why Raylib Container?

Raylib Container provides a consistent, isolated development environment for building games with Raylib, eliminating configuration issues on your host system.

Zero Setup Friction

Pre-configured environment with Raylib, GCC, and all dependencies ready to use

Hardware Acceleration

Direct Rendering Infrastructure (DRI) support for optimal GPU performance

Cross-Platform

Works on Linux, macOS (via XQuartz), and Windows with consistent behavior

Minimal Footprint

Multi-stage Alpine Linux build keeps the container image small and efficient

Key Features

Optimized container image with minimal size using Alpine Linux base, separating build and runtime stages for efficiency.
Direct access to your GPU through Direct Rendering Infrastructure for smooth graphics performance.
Automatic fallback to CPU-based rendering with LIBGL_ALWAYS_SOFTWARE when GPU access is unavailable.
Seamless graphical application support through X11 socket mounting and display environment variable forwarding.
Full macOS support using XQuartz for X Window System implementation.
Raylib is cloned and compiled directly from the official GitHub repository during image build.
GCC compiler and build tools pre-installed for compiling and running your Raylib projects.
Your code stays on the host system via volume mounts, synced in real-time with the container.

Quick Example

Get started with Raylib Container in three simple commands:
1

Enable display access

Allow Docker containers to connect to your graphics server:
xhost +local:docker
2

Build the image

Build the Docker image with Raylib pre-compiled:
docker build -t raylib_container .
3

Run the container

Start the container with hardware acceleration:
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_container

Documentation

Prerequisites

System requirements and initial configuration steps

Quickstart Guide

Get up and running with your first Raylib project

Setup & Deployment

Build images and configure container options

Development Guide

Learn how to develop Raylib games inside the container

Platform Guides

Platform-specific setup for Linux, macOS, and Windows

Troubleshooting

Common issues and solutions

Community

GitHub Repository

View source code and contribute

Docker Hub

Pre-built container images

Build docs developers (and LLMs) love