1

How to create a fake nvidia runtime in my installation of docker, so I can run docker-compose files that specify runtime: nvidia on my laptop ? Something that makes docker --runtime=nvidia equivalent to docker --runtime=runc ?

This would make me able to run containers designed for use with a GPU on my laptop. Currently, docker-compose files that specify runtime: nvidia cause: ERROR: for toto Cannot create container for service toto: Unknown runtime specified nvidia.

PS: I know this is janky but I need to test the containers, without rewriting docker-compose.yaml or having multiple docker-compose files if possible.

1 Answers1

2

For this, I needed to add a runtime called nvidia, just like if I had an nvidia GPU. But since I don't have docker-nvidia-runtime, I need to redirect to runc:

$ find / -name runc 2>/dev/null
/usr/bin/runc

Final command:

$ sudo tee /etc/docker/daemon.json <<EOF
{
    "runtimes": {
        "nvidia": {
            "path": "/usr/bin/runc",
            "runtimeArgs": []
        }
    }
}
EOF
sudo pkill -SIGHUP dockerd