We recently released an image and guide for CPU Monero Mining with Docker. That works well for one system. What happens when you have a number of servers and want to put them to use during what would otherwise be downtime? Today we have a simple guide for getting this working.
If you are new to Docker swarm post-Docker 1.12, you can get up and running within 2-3 minutes.
Here is our Getting Docker Swarm Running in Minutes guide
Once this is setup, the actual process is exceedingly simple. Here we are taking a swarm that encompasses 4-nodes in a 2U chassis and we are making each node mine Monero.
Key aspects to this:
We will soon have a cleaner way to manage mining along with your existing Docker services. In the meantime, using this method you can boot to an image that is part of the docker swarm and then automatically start mining Monero on the nodes. Once a node re-joins the swarm, it will automatically start running the mining image. You can also use commands such as:
And see how many miners are running.
If you are new to Docker swarm post-Docker 1.12, you can get up and running within 2-3 minutes.
Here is our Getting Docker Swarm Running in Minutes guide
Once this is setup, the actual process is exceedingly simple. Here we are taking a swarm that encompasses 4-nodes in a 2U chassis and we are making each node mine Monero.
Code:
docker service create --mode global --name m_test_01 -e username=example@example.com servethehome/monero_cpu_minergate
- We have 4 nodes. By default, Docker will try to run one replica on each node. Therefore, we could use --replicas 4. Instead, we are using --mode global to replicate on every node in our swarm. This is important since if we power off a node, Docker will try to re-balance and place a second mining container on a node.
- We did give this service a name. You will want to kill this service when it is time to utilize the machines for normal production workloads. In this case we are using --name m_test_01 but you can use whatever you want there
- We are using our minergate CPU mining image. You will need to replace "example@example.com" with your minergate username.
We will soon have a cleaner way to manage mining along with your existing Docker services. In the meantime, using this method you can boot to an image that is part of the docker swarm and then automatically start mining Monero on the nodes. Once a node re-joins the swarm, it will automatically start running the mining image. You can also use commands such as:
Code:
$ docker service ls
ID NAME MODE REPLICAS IMAGE
uo4h4vpa5oid m_test_04 global 4/4 servethehome/monero_cpu_minergate:latest
Last edited: