XMRig – Docker Cluster

XMRig – Setup an XMRIG node is relativity easy. However, it can be done even more and automated by using docker swarm. Where it is as simple as adding a node to the swarm cluster and it will automatically setup and configure a miner node on the network. This can either be managed by command line warrior or by using a web interface tool such as portainer.

Environment Variables

The docker image has a set of environment variables to allow to passing of information. For more information, see the actual Github source code.

  • POOL_URL – The URL to the pool where to mine.
  • POOL_USER – The user, in most cases refers to the wallet ID.
  • POOL_PASS – Password, if used, depends from pool to pool.
  • CUDA – Optionally, but allow to set if CUDA should be used for any GPU devices it sees. Note some additional configuration may be needed.
  • OPENCL – Same as CUDA, but OpenCL instead. but can need some additional configuration to pass over the GPU device to be used inside a docker.
  • PRIORITY – Priority, from 0 (lowest) to 5 (highest)

A docker swarm-ready configuration for deploying an XMRIG cluster. It is configured with Global deployment, which means it will run only a single instance on each node.

version: "3.4"

    image: metal3d/xmrig:latest
      - "POOL_URL=PoolURL"
      - "POOL_USER=YourID"
      - "POOL_PASS="
      - "CUDA=false"
      - "OPENCL=false"
      - "PRIORITY=0"
      mode: global # Run a single instead per node 
          memory: 2.5G
        condition: none
docker stack deploy -c xmrig_compose.yml xmrig

By default, it will deploy on all nodes. However, if you wish to restrict to certain nodes within the docker cluster, look at the constraint configuration within docker, to specify on which node it may deploy the docker.