Skip to content

Add OpenCL support to the container #3833

Open

Description

@WesleyFister

Enhancement Type

A completely new feature

Describe the enhancement

With the C2ME mod there' s a beta that enables GPU support with OpenCL. It can be found on their Discord server. You can't run the mod without OpenCL installed or it will crash.

This mod vastly improves chunk generation and therefore the experience of Minecraft. I would consider adding OpenCL to the Docker container once C2ME's GPU support gets officially released on Modrinth.

Activity

  1. itzg commented on Dec 26, 2025

    @itzg
    Owner

    My only concern would be the increase in image size. Will just need to try it and measure with docker history before and after.

    FYI, this was added as a means for custom images to be built

    https://docker-minecraft-server.readthedocs.io/en/latest/misc/building/#installing-extra-packages

  2. mattcam98 commented on Feb 23, 2026

    @mattcam98

    I've successfully implemented OpenCL support for the C2ME mod using a custom image. Total image size increase is only ~2MB (851MB → 853MB) because it uses the generic ICD loader rather than bundling heavy driver packages.

    For anyone looking to implement this, here is the working configuration:

    1. Dockerfile

    The key is installing the generic OpenCL loader and manually pointing it to the NVIDIA library that the Docker runtime injects.

    FROM itzg/minecraft-server:java25
    
    # Install the generic OpenCL loader (very lightweight)
    RUN apt-get update && \
        apt-get install -y --no-install-recommends ocl-icd-libopencl1 && \
        rm -rf /var/lib/apt/lists/*
    
    # Create the vendor hook so the loader finds the NVIDIA driver injected by the host
    RUN mkdir -p /etc/OpenCL/vendors && \
        echo "libnvidia-opencl.so.1" > /etc/OpenCL/vendors/nvidia.icd
    

    2. Docker Compose requirements

    To "link" the hardware to the container, the following environment variables and reservations are required:

    services:
      mc:
        image: mc-opencl:latest
        runtime: nvidia
        environment:
          NVIDIA_VISIBLE_DEVICES: all
          NVIDIA_DRIVER_CAPABILITIES: compute,utility
        deploy:
          resources:
            reservations:
              devices:
                - driver: nvidia
                  count: all
                  capabilities: [gpu]
    

    This setup resolves the OpenCL error [-1001] (CL_PLATFORM_NOT_FOUND_KHR) by ensuring the Java/LWJGL layer has a valid ICD path to the host GPU.

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

Metadata

Metadata

Assignees

No one assigned

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions