Monero CPU Mining in Docker

Notice: Page may contain affiliate links for which we may earn a small commission through services like Amazon Affiliates or Skimlinks.

Patrick

Administrator
Staff member
Dec 21, 2010
12,511
5,792
113
Important Update: 2018-03-25 Updated for the hardfork(s) using Xmrig 2.5.1

For those who want an easy way to mine Monero (XMR) using Docker here is a simple way to run a fairly optimized miner in Docker:
Code:
docker run -d -e username=example@example.com servethehome/monero_cpu_minergate
Replace example@example.com with your minergate username.

This Docker image will compile and run Wolf's CPU miner, automatically detect L3 cache size and launch miners using L3 cache / 2 for threads.

The advantage of using this method is that you can use this to easily launch Monero CPU mining on a Docker swarm cluster.

Note, there are no fees for using this image. If you do want to sign up using our minergate affiliate link (this would be appreciated), here it is:
Smart multicurrency mining pool & 1-click GUI miner

This Docker image seems to be working well on 1-4 socket Intel systems:

upload_2017-1-22_17-7-45.png

Alternative pool miners (use your wallet address instead of example@example.com)
Alternative 1: Moneropool
Code:
docker run -d -e username=example@example.com servethehome/monero_cpu_moneropool
Alternative 2: xmrpool.net
Code:
docker run -d -e username=example@example.com servethehome/monero_cpu_xmrpooldotnet
Feedback is welcome. NVIDIA mining Docker image coming this week.
 
Last edited:
  • Like
Reactions: eva2000 and Marsh

MiniKnight

Well-Known Member
Mar 30, 2012
3,072
973
113
NYC
Nice job on this. I have a higher hash rate than with moneropool too.

I'm going to signup again with minergate to use your code unless you accept donations?
 

Patrick

Administrator
Staff member
Dec 21, 2010
12,511
5,792
113
Is Monero profitable right now?
Depends on what you are mining with and electricity costs.

It is a good way to utilize excess power in a data center rack that you are already paying for.

In Texas and places with inexpensive electricity I believe it is.

Monero has not been impacted by ASICs like Bitcoin.
 

Patrick

Administrator
Staff member
Dec 21, 2010
12,511
5,792
113
I am at a total of 26 bad shares or 0.0027% thus far which is not the most concerning for me.
 

TangoWhiskey9

Active Member
Jun 28, 2013
402
59
28
1 improvement or suggestion

I keep forgetting the username= in the docker cli. If I do that the image doesn't run. Can't I just put an e-mail address without the username?
 

Patrick

Administrator
Staff member
Dec 21, 2010
12,511
5,792
113
Updated to the servethehome repo on Docker hub.

Added a moneropool image (higher-fees but an alternative)
Code:
docker run -d -e username=walletID servethehome/monero_cpu_moneropool
Replace walletID with the ID for your wallet. Moneropool will automatically clear balances of over 0.4 XMR every few hours. I do have a stranded 0.1 XMR balance there because of this :-/ Since the pools do get DDoS'd I wanted to have an option.

Let me know if there is another pool you want to see added.
 

Patrick

Administrator
Staff member
Dec 21, 2010
12,511
5,792
113
Added xmrpool.net as well
Code:
docker run -d -e username=walletID servethehome/monero_cpu_xmrpooldotnet
 

Patrick

Administrator
Staff member
Dec 21, 2010
12,511
5,792
113
Ok - this is really cool. One week later here are the Docker hub stats:

upload_2017-2-6_21-0-9.png
 
  • Like
Reactions: nthu9280

Jon Massey

Active Member
Nov 11, 2015
339
82
28
37
Bear with me chaps, having been a .net developer for the past 10 years and not used much in the way of linux I'm being thrown back in the deep end with an ubuntu workstation on the first day of my PhD so it's probably me that's being a bit dim but...

installed docker.io via apt-get, joined minergate, pulled the docker image but running it doesn't seem to do an awful lot:

Code:
sudo docker run -itd -e username=[redacted]@gmail.com servethehome/monero_cpu_minergate
cbbdfc49899bde56dcc6aedace66144c688421e7a65d4946a7c234c763368903
Every time a run it I just get a hex string back instantly and then it returns - is this the expected behaviour?



EDIT: welp, I shouldn't have been so hasty - it just needed a second or two to start up!
 
Last edited:

Patrick

Administrator
Staff member
Dec 21, 2010
12,511
5,792
113
@Jon Massey - yes!

Now do:
Code:
docker ps
And you will see the image running. If you want to see what the image is doing real-time (using that container ID string):
Code:
docker attach cbbdfc
You can then hit ctrl + p q to return. If you hit ctrl + c you will stop mining.

docker ps should also give you a name (last entry) that you can use instead of cbbdfc....

I actually think monero mining is a great way to learn Docker.
 

Jon Massey

Active Member
Nov 11, 2015
339
82
28
37
Ah excellent, thanks @Patrick ! I'll kill off all the extra instances I started up! Seems like I was getting ~85H/s from each of the two instances I just killed. This is on a HP Z440 w/ E5-1620 v3 and 40GB of RAM.

Pleasantly surprised by how running all this in the background didn't seem to affect the usability of this system. I shall have to look into how much I'm paying for electricity at home to see if it's worthwhile running there.
 
  • Like
Reactions: Patrick

Jon Massey

Active Member
Nov 11, 2015
339
82
28
37
Left running Friday-Mon morning with 1 cpu instance and 1 gpu instance I've mined the princely sum of 0.1moneros or just over 1eur. Not sure this is going to be worth much!
 

Jon Massey

Active Member
Nov 11, 2015
339
82
28
37
Just my workstation with a E5-1620 v3 K620. I've got a couple of old dual X5650 boxes at home which are currently unused (project leftovers), but as they're an older gen and I pay for the electricity there I'm hesitant to spin them back up. I do have a Firepro W7000, a GTX 970 and a GTX750ti that I could press into service, though.
 

Patrick

Administrator
Staff member
Dec 21, 2010
12,511
5,792
113
I guess that is about right. The Monero bits perform better with higher core counts. AMD GPUs are the big winners in terms of H/s per watt. What H/s are you seeing?
 

Patrick

Administrator
Staff member
Dec 21, 2010
12,511
5,792
113
Alternative 2: xmrpool.net
Code:
docker run -d -e username=example@example.com servethehome/monero_cpu_xmrpooldotnet
As a quick note, I recently changed the password for this image to hostname. If you are running this in a swarm, this makes it extremely easy to determine the hashrate of a worker (and if a worker is down). xmrpool.net supports this feature:
upload_2017-2-20_8-30-31.png
It displays container ID. That allows you to tie back easily to a GUI such as Rancher or Portainer:
upload_2017-2-20_8-34-14.png
 

Jon Massey

Active Member
Nov 11, 2015
339
82
28
37
I guess that is about right. The Monero bits perform better with higher core counts. AMD GPUs are the big winners in terms of H/s per watt. What H/s are you seeing?
If I attach to the respective docker containers the terminal says 90H/s on the GPU, 250H/s on the CPU. The dashboard in minergate varies wildly from 100-450H/s
 

Jon

Member
Feb 28, 2016
77
18
8
42
Hi for people that are definitely more in the home server side of thing has someone managed to make the docker run in Unraid?