What is the magic incantation to enable the runtim...
# questions
c
What is the magic incantation to enable the runtime to have docker gpu support? I have the
nvidia-smi
binary installed in the runtime along with all the cuda toolkit prerequisites. So far I've added
--gpus all \
and
-e SANDBOX_ENABLE_GPU=true \
to my docker startup, but
nvidia-smi
on the terminal in the runtime still says it couldn't communicate. I have tested docker with nvidia-smi by itself and it works (see screenshot). The last leg is just getting the open hands ai runtime to start up with the
--gpus all
flag, I think.
I figured it out. Magic incantation:
Copy code
-e SANDBOX_ENABLE_GPU=true \
    -e SANDBOX_CUDA_VISIBLE_DEVICES=0 \
    --gpus all \
But I had to remove the existing container before it would work. Apparently you can't switch an existing container to GPU mode. You have to rm it and recreate it. Final full incantation that works:
Copy code
docker run -it --rm \
    -p 3001:3000 \
    -e WORKSPACE_MOUNT_PATH=$WORKSPACE_BASE \
    -v $WORKSPACE_BASE:/opt/workspace_base \
    -e AGENT_ENABLE_PROMPT_EXTENSIONS=false \
    -e LOG_ALL_EVENTS=true \
    -e LLM_NATIVE_TOOL_CALLING=true \
    -e LLM_DISABLE_STOP_WORD=true \
    -e LLM_REASONING_EFFORT=high \
    -e SANDBOX_ENABLE_GPU=true \
    -e SANDBOX_CUDA_VISIBLE_DEVICES=0 \
    -v ~/.openhands:/.openhands \
    -v /run/user/1000/docker.sock:/var/run/docker.sock \
    --add-host host.docker.internal:192.168.0.144 \
    -e SANDBOX_RUNTIME_CONTAINER_IMAGE=docker.openhands.dev/openhands/runtime:0.60-nikolaik \
    --name openhands-app \
    --gpus all \
    docker.openhands.dev/openhands/openhands:0.60
Screenshot 2025-10-30 at 2.14.23 PM.png
👍 2