Now Reading
Monero NVIDIA GPU Mining with Docker and nvidia-docker

Monero NVIDIA GPU Mining with Docker and nvidia-docker

by Patrick KennedyFebruary 15, 2017

This is a quick guide to mining Monero, a popular cryptocurrency, on a NVIDIA GPU using nvidia-docker. The benefit of this method is that you can use spare GPU cycles on a machine learning server without having to deal with differing CUDA dependencies. Our CPU mining Docker image has tens of thousands of pulls so we are adding a NVIDIA GPU miner.

Quick NVIDIA GPU Monero Mining Performance

Here are a few quick reference points in terms of performance using ccminer-cryptonight, a popular open source Monero NVIDIA GPU miner:

NVIDIA Monero Performance

NVIDIA Monero Performance

We highlighted the NVIDIA GRID M40 extensively. You can also find the ASUS GTX 1060 6GB Dual-Fan we are using here in Deeplearning01 and the PNY GTX 1050 Ti in Deeplearning02.

These are not the most efficient GPUs to mine Monero on, however, if you are looking for something to run when you are not running AI algorithms, this can be a decent option. They can also run while CPUs are running in the background.

Getting Started with Monero NVIDIA GPU Mining with Docker and nvidia-docker

We are going to assume that you have Docker, NVIDIA drivers and nvidia-docker installed. You will also need a free Minergate account. We are also going to use as our account name at Minergate to use in the following examples. You will want to change that to a real address.

If you have a single GPU you can simply use the following one line launch command:

nvidia-docker run -d -e servethehome/monero_gpu_nv_minergate

This downloads and runs a GPU miner on your NVIDIA GPU.

If you have multiple NVIDIA GPUs you need to target one container per GPU. Luckily, with nvidia-docker it is easy to target different GPUs with a container. Here is the example for a dual GPU system:

NV_GPU=0 nvidia-docker run -d -e --name GPU0_monero servethehome/monero_gpu_nv_minergate
NV_GPU=1 nvidia-docker run -d -e --name GPU1_monero servethehome/monero_gpu_nv_minergate
.... and etc.

We have successfully used this method with up to 8 GPUs in a single system. On the same system, we have also used our CPU mining Docker image to run a total of 9 miners.

ASUS GeForce GTX 1060 6GB OC Dual Fa

ASUS GeForce GTX 1060 6GB OC Dual Fa

Again, in the above replace with your minergate username. We are tagging each GPU using NV_GPU and naming each of the miners so you can see which miner attaches to which GPU. That is an important trick when you have multiple GPUs in a system. For example, you can have GPU1 running Tensorflow, GPU2 running NVIDIA DIGITS and GPU3 running Monero mining.

Note, there are no fees for using our nvidia-docker mining image. The mining software is open source, however, minergate does have a low 1% fee. That is lower than other pools we had tried so we are using it in our Docker image.

The advantage of using this method is that you can use this to easily launch Monero GPU mining on NVIDIA GPUs without having to worry about CUDA dependencies.

Final Words

NVIDIA GPUs are not well known for excellent cryptocurrency mining. On the other hand, NVIDIA GPUs are the most commonly deployed GPUs for machine learning/ AI. As a result, many GPUs are deployed in servers and underutilized. This is an interesting way to make a few dollars while learning to use nvidia-docker.

While it was relatively straightforward to get this nice setup working for NVIDIA, for AMD GPUs it is *significantly* harder. The AMD GPU compute ecosystem is still a long way from where NVIDIA’s maturity level is. We have been testing a few images and the AMD GPUs are actually faster, but harder to orchestrate.

We did receive comments from an engineer at a large streaming video “flix” service that our NVIDIA GPU setup can be made more Docker Swarm friendly by not using nvidia-docker. We will be providing a Docker Swarm friendly option soon unless NVIDIA’s team can make this work in the meantime.

This is also a great opportunity to join the STH forums. We have a number of members actively using our Docker images and it is a great community to get involved with if you want to start using spare CPU and GPU cycles in your servers.

About The Author
Patrick Kennedy
Patrick has been running ServeTheHome since 2009 and covers a wide variety of home and small business IT topics. For his day job, Patrick is a management consultant focused in the technology industry and has worked with numerous large hardware and storage vendors in the Silicon Valley. The goal of STH is simply to help users find some information about basic server building blocks. If you have any helpful information please feel free to post on the forums.
  • Aaron
    February 15, 2017 at 3:29 pm

    Thanks for the GPU mining post. Any idea as to why the GTX 1070 performs so poorly, say compared to a 1060?

  • zach
    February 16, 2017 at 8:48 am

    Any chance of an AMD version?
    They are usually a LOT better for mining most coins 🙂

  • Evan
    February 18, 2017 at 7:26 am

    But do you actually “earn” money after accounting for power/cooling costs?

  • maya
    March 14, 2017 at 2:23 am

    Dear Patrick, can you share the Dockerfile
    I wanted to test this setup on my PC but I have an issue with CUDA version 🙂

    nvidia-docker | 2017/03/14 10:19:04 Error: unsupported CUDA version: driver 6.5 < image 8.0

    I would like to remake the image if possible, for cuda and also pools .

    Is it possible to share the Dockerfile ?

    Thank you

    • March 14, 2017 at 5:44 am

      Your issue is with the driver version not the CUDA version.

      The Dockerfile is this:
      FROM ubuntu:trusty
      RUN rm /bin/sh && ln -s /bin/bash /bin/sh
      ADD /usr/local/bin/
      RUN chmod +x /usr/local/bin/
      CMD ["/usr/local/bin/"]

Leave a Response