docker build with nvidia runtime

You need use nvidia-container-runtime as explained in docs: “It is also the only way to have GPU access during docker build”.

Steps for Ubuntu:

  1. Install nvidia-container-runtime:

    sudo apt-get install nvidia-container-runtime

  2. Edit/create the /etc/docker/daemon.json with content:

{
    "runtimes": {
        "nvidia": {
            "path": "/usr/bin/nvidia-container-runtime",
            "runtimeArgs": []
         } 
    },
    "default-runtime": "nvidia" 
}
  1. Restart docker daemon:

    sudo systemctl restart docker

  2. Build your image (now GPU available during build):

    docker build -t my_image_name:latest .

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)