Code Monkey home page Code Monkey logo

docker-xmrig's Introduction

Xmrig - Monero Miner in Docker

Xmrig is an open-source project for mining Monero cryptocurrency. It allows you to mine locally for a pool and receive Monero for your efforts.

Here, you can launch Xmrig in a Podman or Docker container and to easily run it on Kubernetes, or your local computer using standard Docker commands.

Getting Started

To mine for your wallet, you need a Monero wallet (see MyMonero) and follow the instructions below to configure the container accordingly.

Launching Xmrig

docker run --rm -it metal3d/xmrig:latest

By default, without any options, you will mine for me, which is a way to support the project. To mine for your wallet, modify the options using environment variables:

export POOL_URL="your pool URL"
export POOL_USER="Your public Monero address"
export POOL_PASS="can be empty for some pools, otherwise use it as miner ID"
export DONATE_LEVEL="Xmrig project donation in percent, default is 5"

# Update the image
docker pull docker.io/metal3d/xmrig
# Launch the Docker container
docker run --name miner --rm -it \
    -e POOL_URL=$POOL_URL \
    -e POOL_USER=$POOL_USER \
    -e POOL_PASS=$POOL_PASS \
    -e DONATE_LEVEL=$DONATE_LEVEL \
    docker.io/metal3d/xmrig

DONATE_LEVEL is not a donation to me, it's the donation included in the Xmrig project to support its developers. Please leave it at the default value of 5 or higher to contribute to the project.

Press CTRL+C to stop the container, and it will be automatically removed.

Environment Variables

  • POOL_USER: your wallet address (default is mine)
  • POOL_URL: the pool address (default is xmr.metal3d.org:8080)
  • POOL_PASS: the pool password or worker ID (default for me is "donator" + UUID)
  • DONATE_LEVEL: percentage of donation to Xmrig.com project (leave the default at 5 or higher)
  • PRIORITY: CPU priority (0=idle, 1=normal, 2 to 5 for higher priority)
  • THREADS: number of threads to start (default is number of CPU / 2)
  • ACCESS_TOKEN: Bearer access token to access the Xmrig API (served on port 3000, default is a generated token (UUID))
  • ALGO: mining algorithm (default is empty, refer to Xmrig documentation)
  • COIN: coin option instead of algorithm (default is empty)
  • WORKERNAME: naming the worker (generated with a random UUID if not specified)
  • CUDA: activate CUDA (set to "true"). Requires GPU sharing to containers (refer to Nvidia documentation)
  • NO_CPU: deactivate computation on CPU (useful for mining only on CUDA)

Using CUDA

Follow instructions from Nvidia documentation and the page for Podman using CDI if you prefer Podman.

To use CUDA devices:

# Replace podman with docker if you are using Docker
podman run --rm -it \
    --device nvidia.com/gpu=all \
    -e CUDA=true \
    docker.io/metal3d/xmrig

# You can compute only on GPU, but it's not recommended due to frequent GPU errors
podman run --rm -it \
    --device nvidia.com/gpu=all \
    -e CUDA=true \
    -e NO_CPU=true \
    docker.io/metal3d/xmrig

Notes about MSR (Model Specific Registry)

XMRig requires setting MSR (Model Specific Registry) to achieve optimal hashrates. If MSR is not allowed, your hashrate will be low, and a warning will appear in the terminal. To enable MSR inside the container (for Podman), use the following commands:

# Basic mining with CPU (replace podman with docker if you are using Docker)
sudo podman run --rm -it \
    --privileged \
    docker.io/metal3d/xmrig

# To use CUDA devices
sudo podman run --rm -it \
    --privileged \
    --device nvidia.com/gpu=all \
    -e CUDA=true \
    docker.io/metal3d/xmrig

docker-xmrig's People

Contributors

metal3d avatar marcperezpro avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.