Docker Install Nvidia Driver



  • Using the forked version of Docker Machine
    • Using GPUs on Google Compute Engine

The auto scale feature was introduced in GitLab Runner 1.1.0.

The NVIDIA Docker plugin enables deployment of GPU-accelerated applications across any Linux GPU server with NVIDIA Docker support. At NVIDIA, we use containers in a variety of ways including development, testing, benchmarking, and of course in production as the mechanism for deploying deep learning frameworks through the NVIDIA DGX-1’s Cloud. @cdpath $ sudo apt install -y nvidia-docker2 Reading package lists. Done Building dependency tree Reading state information. Done E: Unable to locate package nvidia-docker2. Download the NVIDIA Driver from the download section on the CUDA on WSL page. Choose the appropriate driver depending on the type of NVIDIA GPU in your system - GeForce and Quadro. Install the driver using the executable. This is the only driver you need to install.

For an overview of the autoscale architecture, take a look at thecomprehensive documentation on autoscaling.

Forked version of Docker machine

Because docker-machine is in maintenancemode, GitLab isproviding it’s own fork ofdocker-machine,which is based on the latest master branch of docker-machine withsome additional patches for the following bugs:

The intent of this fork is to fix critical and bugs affecting runningcosts only. No new features will be added.

Preparing the environment

To use the autoscale feature, Docker and GitLab Runner must beinstalled in the same machine:

  1. Log in to a new Linux-based machine that will serve as a bastion serverwhere Docker will spawn new machines from
  2. Optionally but recommended, prepare aproxy container registry and a cache serverto be used with the autoscaled runners

If you need to use any virtualization/cloud providers that aren’t handled byDocker Machine’s internal drivers, the appropriate driver plugin must beinstalled. The Docker Machine driver plugin installation and configuration isout of the scope of this documentation. For more details please read theDocker Machine documentation

Configuring GitLab Runner

Docker
  1. Register a runner and select thedocker+machine executor when asked.
  2. Edit config.toml and configurethe runner to use Docker machine. Visit the dedicated page covering detailedinformation about GitLab Runner Autoscaling.
  3. The first time you’re using Docker Machine, it’s best to execute manuallydocker-machine create ... with your chosen driver and all options from theMachineOptions section. This will set up the Docker Machine environmentproperly and will also be a good validation of the specified options.After this, you can destroy the machine with docker-machine rm [machine_name]and start the runner.

    Multiple concurrent requests to docker-machine create that are doneat first usage are not good. When the docker+machine executor is used,the runner may spin up few concurrent docker-machine create commands. IfDocker Machine was not used before in this environment, each started processtries to prepare SSH keys and SSL certificates (for Docker API authenticationbetween GitLab Runner and Docker Engine on the autoscaled spawned machine), and theseconcurrent processes are disturbing each other. This can end with a non-workingenvironment. That’s why it’s important to create a test machine manually thevery first time you set up GitLab Runner with Docker Machine.
  4. Now, you can try and start a new pipeline in your project. In a few seconds,if you run docker-machine ls you should see a new machine being created.

Upgrading GitLab Runner

  1. Check if your operating system is configured to automatically restart GitLabRunner (for example, by checking its service file):
    • if yes, ensure that service manager is configured to use SIGQUITand use the service’s tools to stop the process:

    • if no, you may stop the process manually:

    Sending the SIGQUIT signal will make theprocess stop gracefully. The process will stop accepting new jobs, and will exitas soon as the current jobs are finished.
  2. Wait until GitLab Runner exits. You can check its status with gitlab-runner statusor await a graceful shutdown for up to 30 minutes with:

  3. You can now safely install the new version of GitLab Runner without interrupting any jobs.

Using the forked version of Docker Machine

Install

  1. Download the appropriate docker-machine binary.Copy the binary to a location accessible to PATH and make itexecutable. For example, to download and install v0.16.2-gitlab.11:

Using GPUs on Google Compute Engine

Introduced in GitLab Docker Machine 0.16.2-gitlab.10 and GitLab Runner 13.9.

GPUs are supported on every executor. It isnot necessary to use Docker Machine just for GPU support. The DockerMachine executor makes it easy to scale the GPU nodes up and down, butthis can also be done with the Kubernetes executor.

You can use the Docker Machine fork to create Google Compute Engine instanceswith graphics processing units (GPUs).GitLab Runner 13.9 is required for GPUs to work in a Docker executor.

Docker Install Nvidia Drivers

Docker Machine GPU options

To create an instance with GPUs, use these Docker Machine options:
OptionExampleDescription
--google-acceleratortype=nvidia-tesla-p4,count=1Specifies the type and number of GPU accelerators to attach to the instance (type=TYPE,count=N format)
--google-maintenance-policyTERMINATEAlways use TERMINATE because Google Cloud does not allow GPU instances to be live migrated.
--google-machine-imagehttps://www.googleapis.com/compute/v1/projects/deeplearning-platform-release/global/images/family/tf2-ent-2-3-cu110The URL of a GPU-enabled operating system. See the list of available images.
--google-metadatainstall-nvidia-driver=TrueThis flag tells the image to install the NVIDIA GPU driver.

These arguments map to command-line arguments for gcloud compute.See the Google documentation on creating VMs with attached GPUsfor more details.

Verifying Docker Machine options

To prepare your system and test that GPUs can be created with Google Compute Engine:

  1. Set up the Google Compute Engine driver credentialsfor Docker Machine. You may need to export environment variables to therunner if your VM does not have a default service account. Howthis is done depends on how the runner is launched. For example:

    • Via systemd or upstart: See the documentation on setting custom environment variables.
    • Via Kubernetes with the Helm Chart: Update the values.yaml entry.
    • Via Docker: Use the -e option (for example, docker run -e GOOGLE_APPLICATION_CREDENTIALS=/path/to/credentials.json gitlab/gitlab-runner).
  2. Verify that docker-machine can create a virtual machine with yourdesired options. For example, to create an n1-standard-1 machinewith a single NVIDIA Telsa P4 accelerator, substitutetest-gpu with a name and run:

  3. To verify the GPU is active, SSH into the machine and run nvidia-smi:

  4. Remove this test instance to save money:

Configuring GitLab Runner

  1. Once you have verified these options, configure the Docker executorto use all available GPUs in the runners.docker configuration.Then add the Docker Machine options to your MachineOptions settings in the GitLab Runner runners.machine configuration. For example:

Help & feedback

Install Nvidia Driver In Docker

Docs
Edit this pageto fix an error or add an improvement in a merge request.
Create an issueto suggest an improvement to this page.
Show and post commentsto review and give feedback about this page.
Product
Create an issueif there's something you don't like about this feature.
Propose functionalityby submitting a feature request.
Join First Lookto help shape new features.
Feature availability and product trials
View pricingto see all GitLab tiers and features, or to upgrade.
Try GitLab for freewith access to all features for 30 days.
Get Help

Ubuntu Docker Install Nvidia Driver

If you didn't find what you were looking for,search the docs.

Install Nvidia Drivers Docker

If you want help with something specific and could use community support,post on the GitLab forum.

For problems setting up or using this feature (depending on your GitLabsubscription).

Request support

Docker Install Nvidia Driver

Please enable JavaScript to view thecomments powered by Disqus.